Module org.jgrapht.core
Package org.jgrapht.graph.builder
Class GraphBuilder<V,E,G extends Graph<V,E>>
- java.lang.Object
-
- org.jgrapht.graph.builder.AbstractGraphBuilder<V,E,G,GraphBuilder<V,E,G>>
-
- org.jgrapht.graph.builder.GraphBuilder<V,E,G>
-
- Type Parameters:
V- the graph vertex typeE- the graph edge typeG- type of the resulting graph
public class GraphBuilder<V,E,G extends Graph<V,E>> extends AbstractGraphBuilder<V,E,G,GraphBuilder<V,E,G>>
A builder class forGraph. This is a helper class which helps adding vertices and edges into an already constructed graph instance.Each graph implementation contains a static helper method for the construction of such a builder. For example class
DefaultDirectedGraphcontains methodDefaultDirectedGraph.createBuilder(Supplier).See
GraphTypeBuilderfor a builder of the actual graph instance.- Author:
- Andrew Chen
- See Also:
GraphTypeBuilder
-
-
Field Summary
-
Fields inherited from class org.jgrapht.graph.builder.AbstractGraphBuilder
graph
-
-
Constructor Summary
Constructors Constructor Description GraphBuilder(G baseGraph)Creates a builder based onbaseGraph.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected GraphBuilder<V,E,G>self()-
Methods inherited from class org.jgrapht.graph.builder.AbstractGraphBuilder
addEdge, addEdge, addEdge, addEdge, addEdgeChain, addGraph, addVertex, addVertices, build, buildAsUnmodifiable, removeEdge, removeEdge, removeVertex, removeVertices
-
-
-
-
Constructor Detail
-
GraphBuilder
public GraphBuilder(G baseGraph)
Creates a builder based onbaseGraph.baseGraphmust be mutable.The recommended way to use this constructor is:
new GraphBuilderBase<...>(new YourGraph<...>(...)).NOTE:
baseGraphshould not be an existing graph. If you want to add an existing graph to the graph being built, you should use theAbstractGraphBuilder.addVertex(Object)method.- Parameters:
baseGraph- the graph object to base building on
-
-