Rooted Tree

Download

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>

Example Code

MutableDirectedUnweightedGraph<String> graph = MutableDirectedUnweightedGraph.create();
graph.insertVertex("A");
graph.insertVertex("B");
graph.insertVertex("C");

graph.addEdge("A", "B");
graph.addEdge("A", "C");

// if the given graph is not satisfying restrictions of rooted tree, following will throw runtime exception.
RootedTree<String, DirectedEdge<String>> tree = RootedTree.wrap(graph, "A");

Implementation


Copyright 2014 psjava team. View on GitHub