[C++] Write connected components of a graph using Boost Graph
- by conradlee
I have an file that is a long list of weighted edges, in the following form
node1_id node2_id weight
node1_id node3_id weight
and so on. So one weighted edge per line.
I want to load this file into boost graph and find the connected components in the graph. Each of these connected components is a subgraph. For each of these component subgraphs, I want to write the edges in the above-described format. I want to do all this using boost graph.
This problem is in principle simple, it's just I'm not sure how to implement it neatly because I don't know my way around Boost Graph. I have already spent some hours and have code that will find the connected components, but my version is surely much longer and more complicated that necessary---I'm hoping there's a boost-graph ninja out there that can show me the right, easy way.