V
- the graph vertex typeE
- the graph edge typeG
- type of the resulting graphB
- type of this builderpublic abstract class AbstractGraphBuilder<V,E,G extends Graph<V,E>,B extends AbstractGraphBuilder<V,E,G,B>> extends Object
Graph
Constructor and Description |
---|
AbstractGraphBuilder(G baseGraph)
Creates a builder based on
baseGraph . |
Modifier and Type | Method and Description |
---|---|
B |
addEdge(V source,
V target)
Adds an edge to the graph being built.
|
B |
addEdge(V source,
V target,
double weight)
Adds an weighted edge to the graph being built.
|
B |
addEdge(V source,
V target,
E edge)
Adds the specified edge to the graph being built.
|
B |
addEdge(V source,
V target,
E edge,
double weight)
Adds the specified weighted edge to the graph being built.
|
B |
addEdgeChain(V first,
V second,
V... rest)
Adds a chain of edges to the graph being built.
|
B |
addGraph(Graph<? extends V,? extends E> sourceGraph)
Adds all the vertices and all the edges of the
sourceGraph to the graph being built. |
B |
addVertex(V vertex)
Adds
vertex to the graph being built. |
B |
addVertices(V... vertices)
Adds each vertex of
vertices to the graph being built. |
G |
build()
Build the graph.
|
Graph<V,E> |
buildAsUnmodifiable()
Build an unmodifiable version graph.
|
UnmodifiableGraph<V,E> |
buildUnmodifiable()
Deprecated.
In favor of
buildAsUnmodifiable() . |
B |
removeEdge(E edge)
Removes the specified edge from the graph.
|
B |
removeEdge(V source,
V target)
Removes an edge going from source vertex to target vertex from the graph being built, if such
vertices and such edge exist in the graph.
|
B |
removeVertex(V vertex)
Removes
vertex from the graph being built, if such vertex exist in graph. |
B |
removeVertices(V... vertices)
Removes each vertex of
vertices from the graph being built, if such vertices exist in
graph. |
protected abstract B |
self() |
public AbstractGraphBuilder(G baseGraph)
baseGraph
. baseGraph
must be mutable.baseGraph
- the graph object to base building onprotected abstract B self()
this
object.public B addVertex(V vertex)
vertex
to the graph being built.vertex
- the vertex to addGraph.addVertex(Object)
@SafeVarargs public final B addVertices(V... vertices)
vertices
to the graph being built.vertices
- the vertices to addaddVertex(Object)
public B addEdge(V source, V target)
source
- source vertex of the edge.target
- target vertex of the edge.Graphs.addEdgeWithVertices(Graph, Object, Object)
public B addEdge(V source, V target, E edge)
source
- source vertex of the edge.target
- target vertex of the edge.edge
- edge to be added to this graph.Graph.addEdge(Object, Object, Object)
@SafeVarargs public final B addEdgeChain(V first, V second, V... rest)
first
- the first vertexsecond
- the second vertexrest
- the remaining verticesaddEdge(Object, Object)
public B addGraph(Graph<? extends V,? extends E> sourceGraph)
sourceGraph
to the graph being built.sourceGraph
- the source graphGraphs.addGraph(Graph, Graph)
public B removeVertex(V vertex)
vertex
from the graph being built, if such vertex exist in graph.vertex
- the vertex to removeGraph.removeVertex(Object)
@SafeVarargs public final B removeVertices(V... vertices)
vertices
from the graph being built, if such vertices exist in
graph.vertices
- the vertices to removeremoveVertex(Object)
public B removeEdge(V source, V target)
source
- source vertex of the edge.target
- target vertex of the edge.Graph.removeVertex(Object)
public B removeEdge(E edge)
edge
- edge to be removed from this graph, if present.Graph.removeEdge(Object)
public B addEdge(V source, V target, double weight)
source
- source vertex of the edge.target
- target vertex of the edge.weight
- weight of the edge.Graphs.addEdgeWithVertices(Graph, Object, Object, double)
public B addEdge(V source, V target, E edge, double weight)
source
- source vertex of the edge.target
- target vertex of the edge.edge
- edge to be added to this graph.weight
- weight of the edge.Graph.addEdge(Object, Object, Object)
,
Graph.setEdgeWeight(Object, double)
public G build()
@Deprecated public UnmodifiableGraph<V,E> buildUnmodifiable()
buildAsUnmodifiable()
.build()
Copyright © 2017. All rights reserved.