snap-stanford / snap

Stanford Network Analysis Platform (SNAP) is a general purpose network analysis and graph mining library.
Other
2.17k stars 797 forks source link

AddNode(Nid) fails on Edge to same Node #144

Closed dkipping closed 6 years ago

dkipping commented 6 years ago

When trying to use the rolx example, I got the error:

*** Error: Execution stopped: !IsNode(NId) [Reason:'NodeId 0 already exists'], file graph.cpp, line 12

Turns out, the AddNode(NId) method in graph.cpp throws that Error when an Edge from a Node to itself exists.

So when I have a line 0 0 in my edge list, it will fail. Removing these edges solves the problem.

Is the behavior meant to be that way? Shall this only work when removing these Edges or is this a bug?

roks commented 6 years ago

Yes, loops are not allowed for rolx.