Class DirectedGraphBuilder

java.lang.Object
org.jhotdraw8.graph.DirectedGraphBuilder

public class DirectedGraphBuilder extends Object
DirectedGraphBuilder.
Author:
Werner Randelshofer
  • 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 type
      A - 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 type
      A - the arrow data type
      Parameters:
      graph - a graph
      vertexPredicate - 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 type
      A - the arrow type
      Parameters:
      source - the source graph
      target - the target graph
    • addAll

      public <V, A, VV, AA> void addAll(@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 graph
      A - the arrow type of the target graph
      VV - the vertex type of the source graph
      AA - the arrow type of the target graph
      Parameters:
      source - the source graph
      target - the target graph