public final class ConnectedComponents extends Object
int[][] g = GraphUtil.toAdjList(container); ConnectedComponents cc = new ConnectedComponents(g); int[] components = cc.components(); for (int v = 0; v < g.length; v++) components[v];
Constructor and Description |
---|
ConnectedComponents(int[][] g)
Compute the connected components of an adjacency list,
g . |
Modifier and Type | Method and Description |
---|---|
int[] |
components()
Access the components each vertex belongs to.
|
int |
nComponents() |
Copyright © 2021. All rights reserved.