public class

DAG

extends Object
java.lang.Object
   ↳ com.microstrategy.utils.DAG

Class Overview

This class represents a generic Directed Acyclic Graph. There are a number of inner classes that represent the parts of this DAG:

  • DAG.Vertex represents a vertex in this graph.
  • DAG.Edge represents an edge in this graph that connects two vertices.

Summary

Nested Classes
class DAG.AnnotatableObject This is a simple object which can be "annotated" with caller-specified properties. 
class DAG.Edge This class represents an Edge in the Directed Acyclic Graph. 
class DAG.Vertex This class represents an end point ("vertex") in a Directed Acyclic Graph. 
Public Constructors
DAG()
Public Methods
DAG.Edge addEdge(DAG.Vertex fromVertex, DAG.Vertex toVertex)
Adds an edge between two vertices.
DAG.Edge getEdge(DAG.Vertex fromVertex, DAG.Vertex toVertex)
Returns an Edge object which connects two Vertices.
Iterator<DAG.Edge> getEdges()
Returns all of the Edges in this DAG.
MessageRouter getMessageRouter()
Returns the Message Router instance to use with this DAG.
DAG.Vertex getVertex(String vertexKey, boolean create)
Returns the Vertex associated with the supplied key.
Iterator<DAG.Vertex> getVertices()
Returns all of the Vertices in this DAG.
void setMessageRouter(MessageRouter msgRouter)
Sets the Message Router instance to use with this DAG.
Iterator<DAG.Vertex> sinkVertices()
Returns the list of sink vertices in the DAG.
Iterator<DAG.Vertex> topoSort()
Performs a topological sort on the contents of this DAG.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public DAG ()

Public Methods

public DAG.Edge addEdge (DAG.Vertex fromVertex, DAG.Vertex toVertex)

Adds an edge between two vertices. If an edge already exists between these vertices, it is returned.

Parameters
fromVertex The DAG.Vertex that represents the "from" end.
toVertex The DAG.Vertex that represents the "to" end.
Returns
  • An existing DAG.Edge (if one exists) or a newly created one that joins the two vertices.

public DAG.Edge getEdge (DAG.Vertex fromVertex, DAG.Vertex toVertex)

Returns an Edge object which connects two Vertices. If not found, then null is returned.

Parameters
fromVertex The DAG.Vertex which is the "from" end.
toVertex The DAG.Vertex which is the "to" end.
Returns
  • Either the DAG.Edge, if it exists, or null.

public Iterator<DAG.Edge> getEdges ()

Returns all of the Edges in this DAG.

Returns

public MessageRouter getMessageRouter ()

Returns the Message Router instance to use with this DAG.

Returns
  • The Message Router instance to use with this DAG.

public DAG.Vertex getVertex (String vertexKey, boolean create)

Returns the Vertex associated with the supplied key.

Parameters
vertexKey The key for the Vertex to return.
create If true and no Vertex was found, then a new Vertex object is created and returned. Otherwise, null is returned.
Returns
  • The DAG.Vertex associated with this key (or a new one if 'create' is true) or null.

public Iterator<DAG.Vertex> getVertices ()

Returns all of the Vertices in this DAG.

Returns

public void setMessageRouter (MessageRouter msgRouter)

Sets the Message Router instance to use with this DAG.

Parameters
msgRouter The Message Router instance to use with this DAG.

public Iterator<DAG.Vertex> sinkVertices ()

Returns the list of sink vertices in the DAG. A sink vertex is a vertex without an out bound edge. A DAG should contain at least one sink vertex.

Returns

public Iterator<DAG.Vertex> topoSort ()

Performs a topological sort on the contents of this DAG. The results are a list of Vertices that satisfies this partial ordering.

Returns