N
- Node content typeE
- Edge content typepublic abstract class AbstractDGraph<N,E> extends Object implements DGraph<N,E>
AbstractDGraph.
Modifier | Constructor and Description |
---|---|
protected |
AbstractDGraph()
Basic constructor.
|
Modifier and Type | Method and Description |
---|---|
SortedSet<Node<N>> |
getSinks()
Returns the sinks of this component.
|
SortedSet<Node<N>> |
getWells()
Returns the wells of this component.
|
boolean |
isAcyclic()
Check if this component is acyclic.
|
void |
save(String filename)
Save the description of this component in a file whose name is specified.
|
List<Node<N>> |
topologicalSort()
Returns a topological sort of the node of this component.
|
String |
toString()
Returns a String representation of this component.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getEdges, getNodes, getPredecessorEdges, getPredecessorNodes, getSuccessorEdges, getSuccessorNodes, sizeEdges, sizeNodes
public final String toString()
Returns a String representation of this component.
public void save(String filename) throws IOException
Save the description of this component in a file whose name is specified.
save
in interface DGraph<N,E>
filename
- the name of the fileIOException
- When an IOException occurspublic final boolean isAcyclic()
Check if this component is acyclic.
public final List<Node<N>> topologicalSort()
Returns a topological sort of the node of this component.
This topological sort is a sort on all the nodes according to their successors. If the graph is not acyclic, some nodes don’t belong to the sort. This treatment is performed in O(n+m), where n corresponds to the number of nodes, and m corresponds to the number of edges.
Copyright © 2010–2016 The Galactic Organization. All rights reserved.