Search in sources :

Example 1 with HierholzerEulerianCycle

use of org.jgrapht.alg.cycle.HierholzerEulerianCycle in project tutorials by eugenp.

the class EulerianCircuitTest method givenGraph_whenCheckEluerianCycle_thenGetResult.

@Test
public void givenGraph_whenCheckEluerianCycle_thenGetResult() {
    HierholzerEulerianCycle eulerianCycle = new HierholzerEulerianCycle<>();
    assertTrue(eulerianCycle.isEulerian(simpleGraph));
}
Also used : HierholzerEulerianCycle(org.jgrapht.alg.cycle.HierholzerEulerianCycle) Test(org.junit.Test)

Example 2 with HierholzerEulerianCycle

use of org.jgrapht.alg.cycle.HierholzerEulerianCycle in project tutorials by eugenp.

the class EulerianCircuitTest method givenGraphWithEulerianCircuit_whenGetEulerianCycle_thenGetGraphPath.

@Test
public void givenGraphWithEulerianCircuit_whenGetEulerianCycle_thenGetGraphPath() {
    HierholzerEulerianCycle eulerianCycle = new HierholzerEulerianCycle<>();
    GraphPath path = eulerianCycle.getEulerianCycle(simpleGraph);
    assertTrue(path.getEdgeList().containsAll(simpleGraph.edgeSet()));
}
Also used : GraphPath(org.jgrapht.GraphPath) HierholzerEulerianCycle(org.jgrapht.alg.cycle.HierholzerEulerianCycle) Test(org.junit.Test)

Aggregations

HierholzerEulerianCycle (org.jgrapht.alg.cycle.HierholzerEulerianCycle)2 Test (org.junit.Test)2 GraphPath (org.jgrapht.GraphPath)1