I'm using Boost library to work with graphs in C++.
boost::adjacency_list <boost::vecS, boost::vecS, boost::bidirectionalS> DiGraph;
DiGraph graph;
boost::add_edge(10000, 20000, graph);
The graph
contains 20001 vertices and one edge. Yet, I need to have only two vertices 10000
and 20000
.
One possible way is to associate data with nodes (e.g. from this example); however, maybe there is a simpler way to do this. How can I have a graph with 2 vertices and one edge, if the vertices are not (0,1)?
In python networkx
I would use simply graph.add_edge(10000, 20000)
and would get desired behavior. Any clues how to do this in C++?