next up previous index
Next: File input and output Up: Other methods Previous: Version number   Index


Workspace

The on-line implementation also provides for the possibility of additional workspace being made available with each node. This may be useful in implementing various graph traversal algorithms. The required workspace may differ for different algorithms. The on-line definition of the Node class is therefore, more fully
protected class Node {
    Object label;
    LinkedList adjacent;
    Object work;
    Node(Object label) {
        this.label = label;
        adjacent = new LinkedList();
        work = null;
    }
}
Extensions of the WeightedGraph class in the same package may choose to allocate storage to the work variable in their own appropriate way.



Peter Williams 2005-06-07