V - the vertex typeE - the edge typepublic final class DAG<V extends Vertex,E extends Edge<V>> extends Object implements Serializable
| Modifier and Type | Class and Description | 
|---|---|
static class  | 
DAG.TraversalOrder
Indicates the traversal order of this DAG. 
 | 
| Modifier and Type | Field and Description | 
|---|---|
static String | 
EMPTY_DAG_DIRECTORY  | 
| Constructor and Description | 
|---|
DAG(Set<V> vertices,
   Map<V,Set<E>> incomingEdges,
   Map<V,Set<E>> outgoingEdges,
   Map<V,LoopVertex> assignedLoopVertexMap,
   Map<V,Integer> loopStackDepthMap)
Constructor of DAG, called by the DAGBuilder. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
<V2 extends Vertex,E2 extends Edge<V2>> | 
convert(Function<DAG<V,E>,DAG<V2,E2>> function)
Converts a DAG into another DAG according to a function. 
 | 
List<V> | 
filterVertices(Predicate<V> condition)
Filters the vertices according to the given condition. 
 | 
List<V> | 
getAncestors(String vertexId)
Retrieves the ancestors of a vertex. 
 | 
LoopVertex | 
getAssignedLoopVertexOf(V v)
Retrieves the wrapping LoopVertex of the vertex. 
 | 
List<V> | 
getChildren(String vertexId)
Retrieves the children vertices of the given vertex. 
 | 
List<V> | 
getDescendants(String vertexId)
Retrieves the descendants of a vertex. 
 | 
E | 
getEdgeBetween(String srcVertexId,
              String dstVertexId)
Retrieves the edge between two vertices. 
 | 
List<E> | 
getIncomingEdgesOf(String vertexId)
Retrieves the incoming edges of the given vertex. 
 | 
List<E> | 
getIncomingEdgesOf(V v)
Retrieves the incoming edges of the given vertex. 
 | 
Integer | 
getLoopStackDepthOf(V v)
Retrieves the stack depth of the given vertex. 
 | 
List<E> | 
getOutgoingEdgesOf(String vertexId)
Retrieves the outgoing edges of the given vertex. 
 | 
List<E> | 
getOutgoingEdgesOf(V v)
Retrieves the outgoing edges of the given vertex. 
 | 
List<V> | 
getParents(String vertexId)
Retrieves the parent vertices of the given vertex. 
 | 
List<V> | 
getRootVertices()
Retrieves the root vertices of this DAG. 
 | 
List<V> | 
getTopologicalSort()
Gets the DAG's vertices in topologically sorted order. 
 | 
V | 
getVertexById(String id)
Retrieves the vertex given its ID. 
 | 
List<V> | 
getVertices()
Retrieves the vertices of this DAG. 
 | 
Boolean | 
isCompositeVertex(V v)
Checks whether the given vertex is assigned with a wrapping LoopVertex. 
 | 
Boolean | 
pathExistsBetween(V v1,
                 V v2)
Function checks whether there is a path between two vertices. 
 | 
void | 
storeJSON(String directory,
         String name,
         String description)
Stores JSON representation of this DAG into a file. 
 | 
void | 
topologicalDo(Consumer<V> function)
Applies the function to each node in the DAG in a topological order. 
 | 
String | 
toString()  | 
public static final String EMPTY_DAG_DIRECTORY
public DAG(Set<V> vertices, Map<V,Set<E>> incomingEdges, Map<V,Set<E>> outgoingEdges, Map<V,LoopVertex> assignedLoopVertexMap, Map<V,Integer> loopStackDepthMap)
vertices - set of vertices.incomingEdges - map of incoming edges for each vertex.outgoingEdges - map of outgoing edges for each vertex.assignedLoopVertexMap - map of assignedLoopVertex info.loopStackDepthMap - map of stack depth of LoopVertices.public <V2 extends Vertex,E2 extends Edge<V2>> DAG<V2,E2> convert(Function<DAG<V,E>,DAG<V2,E2>> function)
V2 - the converted DAG's vertex type.E2 - the converted DAG's edge type.function - to apply when converting a DAG to another.public V getVertexById(String id)
id - of the vertex to retrieveIllegalVertexOperationException - when the requested vertex does not exist.public List<V> getVertices()
DAGBuilder.public List<V> getRootVertices()
public List<E> getIncomingEdgesOf(V v)
v - the subject vertex.DAGBuilder.public List<E> getIncomingEdgesOf(String vertexId)
vertexId - the ID of the subject vertex.DAGBuilder.public List<E> getOutgoingEdgesOf(V v)
v - the subject vertex.DAGBuilder.public List<E> getOutgoingEdgesOf(String vertexId)
vertexId - the ID of the subject vertex.DAGBuilder.public List<V> getParents(String vertexId)
vertexId - the ID of the subject vertex.public List<V> getChildren(String vertexId)
vertexId - the ID of the subject vertex.public E getEdgeBetween(String srcVertexId, String dstVertexId) throws IllegalEdgeOperationException
srcVertexId - the ID of the source vertex.dstVertexId - the ID of the destination vertex.IllegalEdgeOperationException - otherwise.public List<V> getTopologicalSort()
public List<V> getAncestors(String vertexId)
vertexId - to find the ancestors for.public List<V> getDescendants(String vertexId)
vertexId - to find the descendants for.public List<V> filterVertices(Predicate<V> condition)
condition - that must be satisfied to be included in the filtered list.public void topologicalDo(Consumer<V> function)
function - to apply.public Boolean pathExistsBetween(V v1, V v2)
v1 - First vertex to check.v2 - Second vertex to check.public Boolean isCompositeVertex(V v)
v - Vertex to check.public LoopVertex getAssignedLoopVertexOf(V v)
v - Vertex to check.public Integer getLoopStackDepthOf(V v)
v - Vertex to check.Copyright © 2018. All rights reserved.