java.lang.Object
org.jhotdraw8.graph.DirectedGraphBuilder
DirectedGraphBuilder.
- Author:
- Werner Randelshofer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<V,A> void addAll(@NonNull DirectedGraph<V, A> source, @NonNull MutableDirectedGraph<V, A> target) Adds the source graph to the target graph.<V,A, VV, AA>
voidaddAll(@NonNull DirectedGraph<VV, AA> source, @NonNull MutableDirectedGraph<V, A> target, @NonNull Function<VV, V> vertexMapper, @NonNull Function<AA, A> arrowMapper) Adds the source graph to the target graph.<V,A> @NonNull MutableDirectedGraph <V, A> inverseOfDirectedGraph(@NonNull DirectedGraph<V, A> graph) Creates a builder which contains a copy of the specified graph with all arrows inverted.<V,A> @NonNull MutableDirectedGraph <V, A> subsetOfDirectedGraph(@NonNull DirectedGraph<V, A> graph, @NonNull Predicate<V> vertexPredicate) Creates a builder which contains the specified vertices, and only arrows from the directed graph, for the specified vertices.
-
Constructor Details
-
DirectedGraphBuilder
public DirectedGraphBuilder()
-
-
Method Details
-
inverseOfDirectedGraph
public <V,A> @NonNull MutableDirectedGraph<V,A> inverseOfDirectedGraph(@NonNull DirectedGraph<V, A> graph) Creates a builder which contains a copy of the specified graph with all arrows inverted.- Type Parameters:
V- the vertex data typeA- the arrow data type- Parameters:
graph- a graph- Returns:
- a new graph with inverted arrows
-
subsetOfDirectedGraph
public <V,A> @NonNull MutableDirectedGraph<V,A> subsetOfDirectedGraph(@NonNull DirectedGraph<V, A> graph, @NonNull Predicate<V> vertexPredicate) Creates a builder which contains the specified vertices, and only arrows from the directed graph, for the specified vertices.- Type Parameters:
V- the vertex data typeA- the arrow data type- Parameters:
graph- a graphvertexPredicate- a predicate for the vertices- Returns:
- a subset of the directed graph
-
addAll
public <V,A> void addAll(@NonNull DirectedGraph<V, A> source, @NonNull MutableDirectedGraph<V, A> target) Adds the source graph to the target graph.- Type Parameters:
V- the vertex typeA- the arrow type- Parameters:
source- the source graphtarget- the target graph
-
addAll
public <V,A, void addAllVV, AA> (@NonNull DirectedGraph<VV, AA> source, @NonNull MutableDirectedGraph<V, A> target, @NonNull Function<VV, V> vertexMapper, @NonNull Function<AA, A> arrowMapper) Adds the source graph to the target graph.- Type Parameters:
V- the vertex type of the target graphA- the arrow type of the target graphVV- the vertex type of the source graphAA- the arrow type of the target graph- Parameters:
source- the source graphtarget- the target graph
-