Navigation
Synopsis Determine the connected components of a graph.
Function set[set[&T]] connectedComponents(Graph[&T] G)
Usage import analysis::graphs::Graph;
Description Returns the connected components of Graph G, as sets of nodes. All nodes within one component are all reachable from one another, there are no paths between two nodes from different components. The graph is assumed to be undirected.
Examples
rascal>import analysis::graphs::Graph;
ok
rascal>connectedComponents({<1,2>, <1,3>, <4,5>, <5,6>});
set[set[int]]: {
  {1,2,3},
  {4,5,6}
}
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.