javautils.graph
Class AnAugmentedGraph

java.lang.Object
  |
  +--javautils.graph.GraphDecorator
        |
        +--javautils.graph.AnAugmentedGraph
All Implemented Interfaces:
AugmentedGraph, Graph

public final class AnAugmentedGraph
extends GraphDecorator
implements AugmentedGraph

An augmented version of an original Graph-instance. Because this class is final, it is safe to access the original graph which is simply the unaugmented version of the graph.


Method Summary
 java.util.List edgesTo(java.lang.Object node)
          List of all edges to the specified target node.
static AugmentedGraph from(Graph graph)
          An augmented version of the graph.
 boolean isNode(java.lang.Object obj)
          True if and only if the object is a node of this graph.
 Graph original()
          The original, unaugmented, graph.
 
Methods inherited from class javautils.graph.GraphDecorator
edgesFrom, graph, nodes, sourceOf, targetOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javautils.graph.adt.Graph
edgesFrom, nodes, sourceOf, targetOf
 

Method Detail

from

public static AugmentedGraph from(Graph graph)

An augmented version of the graph. If the graph is already augmented, the same graph will be returned.


isNode

public boolean isNode(java.lang.Object obj)
Description copied from interface: AugmentedGraph

True if and only if the object is a node of this graph.

Specified by:
isNode in interface AugmentedGraph

edgesTo

public java.util.List edgesTo(java.lang.Object node)
Description copied from interface: AugmentedGraph

List of all edges to the specified target node.

Important: This method should have O(1) time complexity. This means that you should avoid constructing the list each time this method is called.

Note: The order of edges in the returned list may have an effect on the results of graph algorithms.

Specified by:
edgesTo in interface AugmentedGraph

original

public Graph original()

The original, unaugmented, graph.