Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Subgraph

Name: Anonymous 2010-11-15 3:34

Is there an algorithm to find a connected subgraph in graph ?

Name: Anonymous 2010-11-15 8:03

>>3
Choose a random vertex. Run either a breadth-first or a depth-first search from that vertex. When search terminates, your 'visited' set contains a connected component of the graph.

If you want to split the graph into all connected components, keep the 'not visited set' as well, after step 1 terminates pick any vertex from it, repeat.

If you want to manage connected components in a dynamic graph, look at http://en.wikipedia.org/wiki/Disjoint-set_data_structure

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List