public class Topological extends Object
Modifier and Type | Field and Description |
---|---|
private int[] |
mInDegree
An array that contains the number of incoming edges to a node.
|
private Map |
mIndexMap
A Map that returns the index into mInDegree map for a particular node
in graph.
|
private Partition |
mPartition
The partition that has to be sorted.
|
Constructor and Description |
---|
Topological(Partition p)
The overloaded constructor.
|
Modifier and Type | Method and Description |
---|---|
protected Map |
childrenRepresentation()
Returns a map that is index by GraphNode ID's and each value is the list
of ID's of children of that GraphNode.
|
private int |
index(String id)
Returns the index of a particular node.
|
void |
initialize()
Initializes the inDegree for each node of the partition.
|
List |
sort()
Topologically sorts the partition and returns a List of
GraphNode elements. |
private Partition mPartition
private int[] mInDegree
public Topological(Partition p)
p
- the partition that has to be sorted.public void initialize()
public List sort()
GraphNode
elements. The iterator of the list, returns
the elements in the topological order.GraphNode
objectsprotected Map childrenRepresentation()
private int index(String id)
id
- the id of the node.Copyright © 2011 The University of Southern California. All Rights Reserved.