0

I have a boost adjacency_list, which is my main graph. To this graph, I added some subgraphs using the create_subgraph function.

My question is, how can I get the list of subgraphs I just created without storing the Graph objects?

eg:

Graph g; // typedef for a adj. list
Graph sub_graph1 = g.create_subgraph()
Graph sub_graph2 = g.create_subgraph()
//Do some processing here

//Find all subgraphs of g - iterator/array
Graph all_subgraphs[] =  g.???

Is there any such function which will get me all the subgraphs of the graph g?

YshfOp
  • 1
  • 2

1 Answers1

1

Have a look at the connected_components function. If your subgraphs are disjoint then the number of connected compontns is the number of subgraphs in your graph. Furthermore you can get a component map, i.e. a subgraph index for each graph vertex, from the function.

a2sng
  • 253
  • 3
  • 10