Open zhf-0 opened 3 years ago
Hi,
I am using C++ interface of graphvite. When I instantiate an object of the class Graph and add edges manually, the pseudo code is
Graph
g = Graph(); g.as_undirected = True; g.add_edge("1", "2", 1.5);
By now, everything is fine, g.num_vertex = 2 and g.num_edge = 1. Now, I want to test the property of "undirected graph" , so I add the following
g.num_vertex = 2
g.num_edge = 1
g.add_edge("2", "1", 1.5);
the results are: g.num_vertex = 2 which is right, but g.num_edge = 2!
g.num_edge = 2
In my opinion, since I defined a undirected graph, the edges "1 -> 2" and "2 -> 1" should be the same, thus g.num_edge should equal 1.
g.num_edge
Finally, my question is: Is my understanding about undirected graph wrong? or, Is the way I add edge manually wrong?
Hi,
I am using C++ interface of graphvite. When I instantiate an object of the class
Graph
and add edges manually, the pseudo code isBy now, everything is fine,
g.num_vertex = 2
andg.num_edge = 1
. Now, I want to test the property of "undirected graph" , so I add the followingthe results are:
g.num_vertex = 2
which is right, butg.num_edge = 2
!In my opinion, since I defined a undirected graph, the edges "1 -> 2" and "2 -> 1" should be the same, thus
g.num_edge
should equal 1.Finally, my question is: Is my understanding about undirected graph wrong? or, Is the way I add edge manually wrong?