Skip to content

Commit

Permalink
Bugfix in reading from file
Browse files Browse the repository at this point in the history
  • Loading branch information
pbloem committed Nov 10, 2016
1 parent 86fce0b commit 4f8f8ce
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nodes/src/main/java/org/nodes/DiskDGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ private static long readSorted(List<List<Integer>> list, File file, boolean forw

long links = 0;

Integer current = null;
Integer current = 0;
List<Integer> neighbors = new ArrayList<Integer>();

do
Expand Down
24 changes: 24 additions & 0 deletions nodes/src/test/java/org/nodes/DiskDGraphTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,30 @@ public void testJBC()
assertEquals(2, subgraph.numLinks());
}

@Test
public void degrees()
throws IOException
{
DGraph<String> disk = DiskDGraph.fromFile(new File("/Users/Peter/Documents/Datasets/graphs/wikipedia-nl/wikipedia-nl-simple.txt"), new File("./tmp/"));

DGraph<String> mem = Data.edgeListDirectedUnlabeled(new File("/Users/Peter/Documents/Datasets/graphs/wikipedia-nl/wikipedia-nl-simple.txt"), true);

assertEquals(disk.size(), mem.size());
assertEquals(disk.numLinks(), mem.numLinks());

for(int i : series(disk.size()))
{
try {
assertEquals(mem.get(i).inDegree(), disk.get(i).inDegree());
assertEquals(mem.get(i).outDegree(), disk.get(i).outDegree());
} catch(AssertionError e)
{
System.out.println(i + " mem: " + mem.get(i).inDegree() + " " + mem.get(i).outDegree() + " disk:" + disk.get(i).inDegree() + " " + disk.get(i).outDegree() );
}
}
}


@After
public void cleanup()
{
Expand Down

0 comments on commit 4f8f8ce

Please sign in to comment.