Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SparseIntDirectedGraph returns inconsistent edge information #1042

Closed
vigna opened this issue Feb 19, 2021 · 2 comments · Fixed by #1043
Closed

SparseIntDirectedGraph returns inconsistent edge information #1042

vigna opened this issue Feb 19, 2021 · 2 comments · Fixed by #1043

Comments

@vigna
Copy link

vigna commented Feb 19, 2021

While converting one of our graphs (http://law.di.unimi.it/webdata/enwiki-2013/) to a SparseIntDirectedGraph I ran into inconsistent edge information. More precisely, for some edges returned by outgoingEdgesOf(), getAllEdges() called on the edge endpoints returns the empty set, which is inconsistent, since the edge was returned by outgoingEdgesOf() in the first place.

There is a class reproducing this behavior:

https://github.com/vigna/jgrapht/blob/sux4j-test/jgrapht-unimi-dsi/src/main/java/org/jgrapht/sux4j/SparseGraphTest.java

To reproduce the bug, you have to download enwiki-2013 from the link above (.graph, and .properties files). Then, generate offsets with

java it.unimi.dsi.webgraph.BVGraph -O enwiki-2013

Finally, run the class above with assertions enabled and as only argument the basename of the graph (enwiki-2013, if it is in the current directory):

java -ea org.jgrapht.sux4j.SparseGraphTest enwiki-2013
Exception in thread "main" java.lang.AssertionError: 14395206 (469192 -> 66589)
	at org.jgrapht.sux4j.SparseGraphTest.main(SparseGraphTest.java:128)

The test simply enumerates the edges outgoing of node 469192 and for each edge calls getAllEdges() between the edge endpoints.

@d-michail
Copy link
Member

Thanks, I will take a look.

@d-michail
Copy link
Member

After 3' minutes I noticed that I am performing an equality test with == instead of .equals().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants