Maximal independent vertex sets
npm install maximal-independent-set
var independetSet =//Generate a graphconsole
Given a graph encoded as an adjacency list, compute a maximal independent vertex set (aka vertex packing).
adjacency_listis an array with length = number of vertices, where each ith entry is an array representing the neighbors of vertex i. If your graph is encoded as an edge list instead of an adjacency list, you can use the
starsnpm module to make the necessary conversion.
resultis an optional array that gets the result of the independent set. If not specified, a new Uint8Array is created.
Returns A vector whose ith entry determines whether the vertex is contained in the independent set or not
(c) 2013 Mikola Lysenko. MIT License