Class ValueGraphBuilder<N,​V>


  • @Beta
    public final class ValueGraphBuilder<N,​V>
    extends AbstractGraphBuilder<N>
    A builder for constructing instances of MutableValueGraph 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:

    
     MutableValueGraph<String, Double> graph =
         ValueGraphBuilder.undirected().allowsSelfLoops(true).build();
     graph.putEdgeValue("San Francisco", "San Francisco", 0.0);
     graph.putEdgeValue("San Jose", "San Jose", 0.0);
     graph.putEdgeValue("San Francisco", "San Jose", 48.4);
     
    Since:
    20.0
    • Constructor Detail

      • ValueGraphBuilder

        private ValueGraphBuilder​(boolean directed)
        Creates a new instance with the specified edge directionality.