Class DirectedGraph<V>

java.lang.Object
org.pf4j.util.DirectedGraph<V>

public class DirectedGraph<V> extends Object
See Wikipedia for more information.
Author:
Decebal Suiu
  • Constructor Details

    • DirectedGraph

      public DirectedGraph()
  • Method Details

    • addVertex

      public void addVertex(V vertex)
      Add a vertex to the graph. Nothing happens if vertex is already in graph.
    • containsVertex

      public boolean containsVertex(V vertex)
      True if graph contains vertex.
    • removeVertex

      public void removeVertex(V vertex)
    • addEdge

      public void addEdge(V from, V to)
      Add an edge to the graph; if either vertex does not exist, it's added. This implementation allows the creation of multi-edges and self-loops.
    • removeEdge

      public void removeEdge(V from, V to)
      Remove an edge from the graph. Nothing happens if no such edge.
    • getNeighbors

      public List<V> getNeighbors(V vertex)
    • outDegree

      public Map<V,Integer> outDegree()
      Report (as a Map) the out-degree (the number of tail ends adjacent to a vertex) of each vertex.
    • inDegree

      public Map<V,Integer> inDegree()
      Report (as a Map) the in-degree (the number of head ends adjacent to a vertex) of each vertex.
    • topologicalSort

      public List<V> topologicalSort()
      Report (as a List) the topological sort of the vertices; null for no such sort. See this for more information.
    • reverseTopologicalSort

      public List<V> reverseTopologicalSort()
      Report (as a List) the reverse topological sort of the vertices; null for no such sort.
    • isDag

      public boolean isDag()
      True if graph is a dag (directed acyclic graph).
    • toString

      public String toString()
      String representation of graph.
      Overrides:
      toString in class Object