Package dev.nm.graph.type
Class SparseDAGraph<V,E extends Arc<V>>
- java.lang.Object
-
- dev.nm.graph.type.SparseGraph<V,E>
-
- dev.nm.graph.type.SparseDiGraph<V,E>
-
- dev.nm.graph.type.SparseDAGraph<V,E>
-
-
Constructor Summary
Constructors Constructor Description SparseDAGraph()Construct an empty directed acyclic graph.SparseDAGraph(boolean toCheckCyclicity)Construct an empty directed acyclic graph.SparseDAGraph(DAGraph<V,E> g)(Copy) construct a directed acyclic graph from another directed acyclic graph.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SparseDAGraph<V,E>addEdge(E e)Adds an edge to this graph.booleanisAcyclic()Runs validity check to ensure that this DA graph is indeed acyclic.inttopologicalOrder(V v)Get the topological order of a vertex.-
Methods inherited from class dev.nm.graph.type.SparseDiGraph
children, incomingArcs, outgoingArcs, parents, toString, vertices
-
Methods inherited from class dev.nm.graph.type.SparseGraph
addVertex, contains, edges, edges, removeEdge, removeVertex
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface dev.nm.graph.DiGraph
children, incomingArcs, outgoingArcs, parents
-
Methods inherited from interface dev.nm.graph.Graph
addVertex, edges, edges, removeEdge, removeVertex, vertices
-
-
-
-
Constructor Detail
-
SparseDAGraph
public SparseDAGraph(boolean toCheckCyclicity)
Construct an empty directed acyclic graph.- Parameters:
toCheckCyclicity-trueif to check cyclicity each time an edge is added (slow performance)
-
SparseDAGraph
public SparseDAGraph()
Construct an empty directed acyclic graph.
-
-
Method Detail
-
addEdge
public SparseDAGraph<V,E> addEdge(E e)
Description copied from interface:GraphAdds an edge to this graph. Does nothing ifeis already in the graph. If the edge contains new vertices, those will be added to the graph.
-
topologicalOrder
public int topologicalOrder(V v)
Description copied from interface:DAGraphGet the topological order of a vertex.
-
isAcyclic
public boolean isAcyclic()
Runs validity check to ensure that this DA graph is indeed acyclic.- Returns:
trueif this graph is acyclic
-
-