Search in sources :

Example 11 with DoubleComparator

use of org.neo4j.graphalgo.impl.util.DoubleComparator in project neo4j by neo4j.

the class NetworkRadiusTest method testChain.

@Test
public void testChain() {
    graph.makeEdgeChain("a,b,c,d,e");
    NetworkRadius<Double> radius = new NetworkRadius<Double>(getSingleSourceShortestPath(), 0.0, graph.getAllNodes(), new DoubleComparator());
    assertTrue(radius.getCentrality(null) == 2.0);
}
Also used : NetworkRadius(org.neo4j.graphalgo.impl.centrality.NetworkRadius) DoubleComparator(org.neo4j.graphalgo.impl.util.DoubleComparator) Test(org.junit.Test)

Example 12 with DoubleComparator

use of org.neo4j.graphalgo.impl.util.DoubleComparator in project neo4j by neo4j.

the class NetworkRadiusTest method testBox.

@Test
public void testBox() {
    graph.makeEdgeChain("a,b,c,d,a");
    NetworkRadius<Double> radius = new NetworkRadius<Double>(getSingleSourceShortestPath(), 0.0, graph.getAllNodes(), new DoubleComparator());
    assertTrue(radius.getCentrality(null) == 2.0);
}
Also used : NetworkRadius(org.neo4j.graphalgo.impl.centrality.NetworkRadius) DoubleComparator(org.neo4j.graphalgo.impl.util.DoubleComparator) Test(org.junit.Test)

Example 13 with DoubleComparator

use of org.neo4j.graphalgo.impl.util.DoubleComparator in project neo4j by neo4j.

the class NetworkRadiusTest method testPlusShape.

@Test
public void testPlusShape() {
    graph.makeEdgeChain("a,b,c");
    graph.makeEdgeChain("d,b,e");
    NetworkRadius<Double> radius = new NetworkRadius<Double>(getSingleSourceShortestPath(), 0.0, graph.getAllNodes(), new DoubleComparator());
    assertTrue(radius.getCentrality(null) == 1.0);
}
Also used : NetworkRadius(org.neo4j.graphalgo.impl.centrality.NetworkRadius) DoubleComparator(org.neo4j.graphalgo.impl.util.DoubleComparator) Test(org.junit.Test)

Example 14 with DoubleComparator

use of org.neo4j.graphalgo.impl.util.DoubleComparator in project graphdb by neo4j-attic.

the class NetworkDiameterTest method testPlusShape.

@Test
public void testPlusShape() {
    graph.makeEdgeChain("a,b,c");
    graph.makeEdgeChain("d,b,e");
    NetworkDiameter<Double> diameter = new NetworkDiameter<Double>(getSingleSourceShortestPath(), 0.0, graph.getAllNodes(), new DoubleComparator());
    assertTrue(diameter.getCentrality(null) == 2.0);
}
Also used : NetworkDiameter(org.neo4j.graphalgo.impl.centrality.NetworkDiameter) DoubleComparator(org.neo4j.graphalgo.impl.util.DoubleComparator) Test(org.junit.Test)

Example 15 with DoubleComparator

use of org.neo4j.graphalgo.impl.util.DoubleComparator in project graphdb by neo4j-attic.

the class NetworkRadiusTest method testBox.

@Test
public void testBox() {
    graph.makeEdgeChain("a,b,c,d,a");
    NetworkRadius<Double> radius = new NetworkRadius<Double>(getSingleSourceShortestPath(), 0.0, graph.getAllNodes(), new DoubleComparator());
    assertTrue(radius.getCentrality(null) == 2.0);
}
Also used : NetworkRadius(org.neo4j.graphalgo.impl.centrality.NetworkRadius) DoubleComparator(org.neo4j.graphalgo.impl.util.DoubleComparator) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)16 DoubleComparator (org.neo4j.graphalgo.impl.util.DoubleComparator)16 NetworkDiameter (org.neo4j.graphalgo.impl.centrality.NetworkDiameter)6 NetworkRadius (org.neo4j.graphalgo.impl.centrality.NetworkRadius)6 List (java.util.List)4 Dijkstra (org.neo4j.graphalgo.impl.shortestpath.Dijkstra)4 DoubleAdder (org.neo4j.graphalgo.impl.util.DoubleAdder)4 Direction (org.neo4j.graphdb.Direction)4 Relationship (org.neo4j.graphdb.Relationship)4 PropertyContainer (org.neo4j.graphdb.PropertyContainer)2