Class GraphBuilder<N>


  • @Beta
    public final class GraphBuilder<N>
    extends java.lang.Object
    A builder for constructing instances of MutableGraph with user-defined properties.

    A graph built by this class will have the following properties by default:

    • does not allow self-loops
    • orders Graph.nodes() in the order in which the elements were added

    Example of use:

    
     MutableGraph<String> graph = GraphBuilder.undirected().allowsSelfLoops(true).build();
     graph.putEdge("bread", "bread");
     graph.putEdge("chocolate", "peanut butter");
     graph.putEdge("peanut butter", "jelly");
     
    Since:
    20.0
    Author:
    James Sexton, Joshua O'Madadhain