Download jar file or use maven. psjava requires Java 1.6 (or above)
<dependency>
<groupId>org.psjava</groupId>
<artifactId>psjava</artifactId>
<version>0.1.19</version>
</dependency>
// Let's prepare a simple graph. MutableDirectedUnweightedGraph<String> graph = MutableDirectedUnweightedGraph.create(); graph.insertVertex("A"); graph.insertVertex("B"); graph.insertVertex("C"); graph.addEdge("A", "B"); graph.addEdge("B", "C"); graph.addEdge("C", "B"); boolean hasCycle = CycleDetection.hasCycle(graph); // must be true
Copyright 2014 psjava team. View on GitHub