javautils.graph.testing
Class BasicGraph

java.lang.Object
  |
  +--javautils.collections.Algs
        |
        +--javautils.graph.testing.BasicGraph
All Implemented Interfaces:
Graph

public class BasicGraph
extends Algs
implements Graph

Basic implementation of the Graph-inferface for testing.


Field Summary
 
Fields inherited from class javautils.collections.Algs
EMPTY_ARRAY, EMPTY_LIST, EMPTY_MAP, EMPTY_SEQUENCE, EMPTY_SET
 
Constructor Summary
BasicGraph(java.lang.Object[][] graph)
          A Graph created from the given "association table" representation.
 
Method Summary
 java.util.List edgesFrom(java.lang.Object node)
          List of all edges from the specified source node.
 java.util.List nodes()
          List of all nodes.
 java.lang.Object sourceOf(java.lang.Object edge)
          The source node of the edge.
 java.lang.Object targetOf(java.lang.Object edge)
          The target node of the edge.
 
Methods inherited from class javautils.collections.Algs
addAll, allSuperInterfaces, asArray, asArray, asComparator, asUnmodifiableList, collect, collectMap, collectSet, collectUnmodifiable, concat, concat, concat, copyOf, copyOf, copyOf, copyOf, copyOf, copyOf, copyOf, copyOf, copyOf, copyOfArray, drop, ensureLength, exists, exists, exists, filter, filter, filter, find, find, find, flatten, flatten, flatten, fold, fold, fold, foldRight, foldRight, foldRight, forAll, forAll, forAll, forEach, forEach, forEach, forEach, forEach, forEach, forEachInProduct, forEachInProduct, forEachInProduct, forEachInProduct, genAddAll, genConcat, genConcat, genForEach, genForEach, getOrIfNull, integersInRange, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iterator, iteratorOverArray, map, map, map, map, map, map, mapMorphism, mapMorphismTo, mapTransform, max, max, max, max, max, max, max, min, min, min, min, min, min, min, newMap, newShapedArray, newUnmodifiableList, putAll, putAll, reverseIterator, reverseIterator, select, select, select, sign, singletonIterator, sort, sort, sorted, sorted, take, transform, transform, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicGraph

public BasicGraph(java.lang.Object[][] graph)

A Graph created from the given "association table" representation.

Method Detail

nodes

public java.util.List nodes()
Description copied from interface: Graph

List of all nodes.

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 nodes in the returned list may have an effect on the results of graph algorithms.

Specified by:
nodes in interface Graph

edgesFrom

public java.util.List edgesFrom(java.lang.Object node)
Description copied from interface: Graph

List of all edges from the specified source 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:
edgesFrom in interface Graph

sourceOf

public java.lang.Object sourceOf(java.lang.Object edge)
Description copied from interface: Graph

The source node of the edge.

Specified by:
sourceOf in interface Graph

targetOf

public java.lang.Object targetOf(java.lang.Object edge)
Description copied from interface: Graph

The target node of the edge.

Specified by:
targetOf in interface Graph