DeepGraphLearning / graphvite

GraphVite: A General and High-performance Graph Embedding System
https://graphvite.io
Apache License 2.0
1.21k stars 151 forks source link

strange behavior about the undirected graph #82

Open zhf-0 opened 3 years ago

zhf-0 commented 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

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.add_edge("2", "1", 1.5);

the results are: g.num_vertex = 2 which is right, but 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.

Finally, my question is: Is my understanding about undirected graph wrong? or, Is the way I add edge manually wrong?