public class AdjacencyListGraph
extends java.lang.Object
Object
so that you can build up
your graphs with any object type.
Modifier and Type | Field and Description |
---|---|
protected java.util.Vector<java.lang.Object> |
adjLists
The adjacency lists in the order as the nodes wre added.
|
protected java.util.Hashtable<java.lang.Object,java.lang.Object[]> |
cacheListByNode
The unique identifier of the node (e.g. database table name).
|
Constructor and Description |
---|
AdjacencyListGraph()
Constructor for this class.
|
Modifier and Type | Method and Description |
---|---|
void |
addAdjacencyList(java.lang.Object node,
java.lang.Object[] list)
Adds an adjacency list for a graph node.
|
void |
debugPrint()
Prints the adjacency lists currently managed by this object.
|
protected void |
finalize()
Helps the garbage collector.
|
java.util.Vector<java.lang.Object> |
findCycles()
Checks whether this adjacency list graph has cycles.
|
java.lang.Object[] |
getAdjacencyList(java.lang.Object node)
Provides the adjacency list for the given node.
|
java.lang.Object[] |
getAdjacencyNodes()
Provides the list of nodes for which adjacency lists do exist.
|
java.util.Vector<java.lang.Object> |
sortTopologically(boolean reverse)
Performs topological sorting of the nodes of this adjacency list graph.
|
protected java.util.Hashtable<java.lang.Object,java.lang.Object[]> cacheListByNode
protected java.util.Vector<java.lang.Object> adjLists
public AdjacencyListGraph()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void addAdjacencyList(java.lang.Object node, java.lang.Object[] list)
node
- The node objectlist
- The list for the nodejava.lang.NullPointerException
- If parameters are null
public java.lang.Object[] getAdjacencyList(java.lang.Object node)
node
- The node objectnull
java.lang.NullPointerException
- If parameters are null
public java.lang.Object[] getAdjacencyNodes()
MissingValue
object indicates that a foreign key relation could be be
resolved due to a missing table definition.
public java.util.Vector<java.lang.Object> findCycles()
public java.util.Vector<java.lang.Object> sortTopologically(boolean reverse)
reverse
- Reverse sorting?public void debugPrint()
Copyright © 2005-2013 Leisenfels UG (haftungsbeschränkt). All rights reserved.