I'm using the Boost Graph Library to process an undirected graph, and declared my graph has
typedef property<vertex_index_t, int, property<vertex_name_t, string> > VertexProperty;
typedef adjacency_list<vecS, setS, undirectedS, VertexProperty > UndirectedGraph;
As you can see, the OutEdgeList is of the type std::set and I chose it because the documentation says that this type will enforce the absence of parallel edges.
Now, my program reads a text file which indicates edges between nodes, creates the nodes if not previously seen and adds the edge between them.
I recently run the code with a large amount of data and found strange results. After some hours I discovered some user which had more degree than the number of vertices in the graph, so I tried the code with a simple text file that only described two edges between the same pair of nodes but with reversed source,target, such that boost will execute the following:
add_edge(A,B)
add_edge(B,A)
And noticed Boost ended up adding both edges. out_degree returns 2 for both of them.
Now, the question: am I doing something wrong? Shouldn't add_edge(a,b) be the same as add_edge(b,a) for an undirected graph with setS as the OutEdgeList type?
Thanks. ;)