Search in sources :

Example 1 with NetworkDiameter

use of org.neo4j.graphalgo.impl.centrality.NetworkDiameter in project graphdb by neo4j-attic.

the class NetworkDiameterTest method testBox.

@Test
public void testBox() {
    graph.makeEdgeChain("a,b,c,d,a");
    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 2 with NetworkDiameter

use of org.neo4j.graphalgo.impl.centrality.NetworkDiameter in project graphdb by neo4j-attic.

the class NetworkDiameterTest method testChain.

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

Example 3 with NetworkDiameter

use of org.neo4j.graphalgo.impl.centrality.NetworkDiameter in project neo4j by neo4j.

the class NetworkDiameterTest method testBox.

@Test
public void testBox() {
    graph.makeEdgeChain("a,b,c,d,a");
    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 4 with NetworkDiameter

use of org.neo4j.graphalgo.impl.centrality.NetworkDiameter in project neo4j by neo4j.

the class NetworkDiameterTest method testChain.

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

Example 5 with NetworkDiameter

use of org.neo4j.graphalgo.impl.centrality.NetworkDiameter in project neo4j by neo4j.

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)

Aggregations

Test (org.junit.Test)6 NetworkDiameter (org.neo4j.graphalgo.impl.centrality.NetworkDiameter)6 DoubleComparator (org.neo4j.graphalgo.impl.util.DoubleComparator)6