|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--saffron.util.Graph
A Graph
is a collection of directed arcs between nodes, and
supports various graph-theoretic operations.
Nested Class Summary | |
static class |
Graph.Arc
An Arc is a directed link between two nodes. |
static class |
Graph.GraphTest
|
Field Summary | |
private HashSet |
arcs
|
private boolean |
mutable
|
static Graph.Arc[] |
noArcs
|
private HashMap |
shortestPath
Maps Graph.Arc to Graph.Arc []. |
Constructor Summary | |
Graph()
|
Method Summary | |
Graph.Arc |
createArc(Object from,
Object to)
|
private void |
findPaths(Object from,
Object to,
List list)
|
private void |
findPathsExcluding(Object from,
Object to,
List list,
HashSet excludedNodes,
List prefix)
Finds all paths from "from" to "to" of length 2 or greater, such that the intermediate nodes are not contained in "excludedNodes". |
Iterator |
getPaths(Object from,
Object to)
Returns an iterator of all paths between two nodes, shortest first. |
Graph.Arc[] |
getShortestPath(Object from,
Object to)
Returns the shortest path between two points, null if there is no path. |
private void |
makeImmutable()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private HashSet arcs
private boolean mutable
private HashMap shortestPath
Graph.Arc
to Graph.Arc
[].
public static final Graph.Arc[] noArcs
Constructor Detail |
public Graph()
Method Detail |
public Graph.Arc createArc(Object from, Object to)
private void makeImmutable()
public Graph.Arc[] getShortestPath(Object from, Object to)
from
- to
-
public Iterator getPaths(Object from, Object to)
The current implementation is not optimal.
private void findPaths(Object from, Object to, List list)
private void findPathsExcluding(Object from, Object to, List list, HashSet excludedNodes, List prefix)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |