Package com.jgalgo.gen
Class EmptyGraphGenerator<V,E>
- java.lang.Object
-
- com.jgalgo.gen.EmptyGraphGenerator<V,E>
-
- Type Parameters:
V
- the vertices typeE
- 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 Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <V,E>
Graph<V,E>emptyGraph(Collection<V> vertices)
Generate a new empty undirected graph.GraphBuilder<V,E>
generateIntoBuilder()
Generates a graph into a builder.static <V,E>
EmptyGraphGenerator<V,E>newInstance()
Creates a new empty graph generator.static EmptyGraphGenerator<Integer,Integer>
newIntInstance()
Creates a new empty graph generator forIntGraph
.void
setDirected(boolean directed)
Determine if the generated graph(s) is directed or undirected.void
setVertices(Collection<V> vertices)
Set the vertices of the generated graph(s).-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.jgalgo.gen.GraphGenerator
generate, generateMutable
-
-
-
-
Method Detail
-
newInstance
public static <V,E> EmptyGraphGenerator<V,E> newInstance()
Creates a new empty graph generator.- Type Parameters:
V
- the vertices typeE
- the edges type- Returns:
- a new empty graph generator
-
newIntInstance
public static EmptyGraphGenerator<Integer,Integer> newIntInstance()
Creates a new empty graph generator forIntGraph
.- Returns:
- a new empty graph generator for
IntGraph
-
emptyGraph
public static <V,E> Graph<V,E> emptyGraph(Collection<V> vertices)
Generate a new empty undirected graph.- Type Parameters:
V
- the vertices typeE
- 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 interfaceGraphGenerator<V,E>
- Returns:
- a new graph builder populated by the generator with the generator parameters
-
-