Class EmptyGraphGenerator<V,​E>

  • Type Parameters:
    V - the vertices type
    E - the edges type
    All Implemented Interfaces:
    GraphGenerator<V,​E>

    public class EmptyGraphGenerator<V,​E>
    extends Object
    implements GraphGenerator<V,​E>
    A generator of empty graphs.

    An empty graph is a graph with no edges, and it may contains some vertices.

    Author:
    Barak Ugav
    • Method Detail

      • newInstance

        public static <V,​E> EmptyGraphGenerator<V,​E> newInstance()
        Creates a new empty graph generator.
        Type Parameters:
        V - the vertices type
        E - the edges type
        Returns:
        a new empty graph generator
      • emptyGraph

        public static <V,​E> Graph<V,​E> emptyGraph​(Collection<V> vertices)
        Generate a new empty undirected graph.
        Type Parameters:
        V - the vertices type
        E - the edges type
        Parameters:
        vertices - the vertices of the generated graph
        Returns:
        a new empty undirected graph
      • setVertices

        public void setVertices​(Collection<V> vertices)
        Set the vertices of the generated graph(s).

        If this function is not called before generating a graph, no vertices will be added to the graph.

        Parameters:
        vertices - the vertices of the generated graph(s)
      • setDirected

        public void setDirected​(boolean directed)
        Determine if the generated graph(s) is directed or undirected.

        By default, the generated graph(s) is undirected.

        Parameters:
        directed - true if the generated graph(s) will be directed, false if undirected
      • generateIntoBuilder

        public GraphBuilder<V,​E> generateIntoBuilder()
        Description copied from interface: GraphGenerator
        Generates a graph into a builder.

        This is the a more flexible way to generate a graph. The builder can be used to generate a mutable or immutable graph, or to add additional vertices or edges on top of the generated ones.

        Specified by:
        generateIntoBuilder in interface GraphGenerator<V,​E>
        Returns:
        a new graph builder populated by the generator with the generator parameters