public class DAG
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Constructor and Description |
---|
DAG() |
Modifier and Type | Method and Description |
---|---|
void |
addEdge(java.lang.String from,
java.lang.String to) |
void |
addEdge(Vertex from,
Vertex to) |
Vertex |
addVertex(java.lang.String label)
Adds vertex to DAG.
|
java.lang.Object |
clone() |
java.util.List |
getChildLabels(java.lang.String label) |
java.util.Set |
getLabels() |
java.util.List |
getParentLabels(java.lang.String label) |
java.util.List |
getSuccessorLabels(java.lang.String label)
Return the list of labels of successor in order decided by topological sort
|
Vertex |
getVertex(java.lang.String label) |
java.util.List |
getVerticies() |
boolean |
hasEdge(java.lang.String label1,
java.lang.String label2) |
boolean |
isConnected(java.lang.String label)
Indicates if there is at least one edge leading to or from vertex of given label
|
void |
removeEdge(java.lang.String from,
java.lang.String to) |
void |
removeEdge(Vertex from,
Vertex to) |
public java.util.List getVerticies()
public java.util.Set getLabels()
public Vertex addVertex(java.lang.String label)
label
- The lable of the Vertexpublic void addEdge(java.lang.String from, java.lang.String to) throws CycleDetectedException
CycleDetectedException
public void addEdge(Vertex from, Vertex to) throws CycleDetectedException
CycleDetectedException
public void removeEdge(java.lang.String from, java.lang.String to)
public Vertex getVertex(java.lang.String label)
public boolean hasEdge(java.lang.String label1, java.lang.String label2)
public java.util.List getChildLabels(java.lang.String label)
label
- public java.util.List getParentLabels(java.lang.String label)
label
- public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
Object.clone()
public boolean isConnected(java.lang.String label)
true if this vertex is connected with other vertex,false
otherwise
public java.util.List getSuccessorLabels(java.lang.String label)
label
- The label of the vertex whose predessors are serched