|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.util.Graphs
A collection of methods that operate on graphs
.
Nested Class Summary | |
static interface |
Graphs.EdgeSelector
|
static class |
Graphs.EqualityTerminator
|
static interface |
Graphs.NodeSelector
|
Field Summary | |
static Graphs.EdgeSelector |
FORWARD_SELECTOR
A simple implementation of the Graphs.EdgeSelector interface that
selects outgoing edges. |
Method Summary | |
static List |
edgePathToNodePath(List edgePath)
|
static List |
findPath(Graph graph,
Object startNode,
Graphs.EdgeSelector selector,
Graphs.NodeSelector terminator)
Performs a traversal of graph looking for path that starts
with startNode and terminates with a node that satisfies the
test specified by terminator and consists only of those
edges that satisfy the test specified by selector . |
static List |
findPath(Graph graph,
Object begin,
Object end)
Finds a path in graph from begin to end |
static List |
getSinkNodes(Graph gg)
Returns a list of nodes in gg that have no outgoing edges. |
static Graph |
nodesReachableFrom(Graph graph,
Object start)
|
static void |
printGraph(Graph graph,
GraphFormatter fmtr,
PrintWriter writer)
Pretty-prints the graph. |
static void |
printTree(Tree tree,
GraphFormatter fmtr,
PrintWriter writer)
Pretty-prints the tree in a format patterned off of the DOT language. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final Graphs.EdgeSelector FORWARD_SELECTOR
Graphs.EdgeSelector
interface that
selects outgoing edges.
Method Detail |
public static final List findPath(Graph graph, Object begin, Object end)
graph
from begin to end
NullPointerException
- if any of the three arguments is null
.findPath(Graph, Object, Graphs.EdgeSelector, Graphs.NodeSelector)
public static List findPath(Graph graph, Object startNode, Graphs.EdgeSelector selector, Graphs.NodeSelector terminator)
graph
looking for path that starts
with startNode
and terminates with a node that satisfies the
test specified by terminator
and consists only of those
edges that satisfy the test specified by selector
.
terminator
, such that all edges in the path
satisfy the condition specified by selector
. An empty list
is returned, if no such path can be found.public static final List edgePathToNodePath(List edgePath)
edgePath
- a list of edges such as the one returned by
findPath(Graph, Object, Object)
.
IllegalStateException
- if edgePath
is not a valid
path. For example, (a->b, c->d, d->e)
is invalid, because
the edge between b
and c
is missing.
NullPointerException
- if edgePath
is null
public static Graph nodesReachableFrom(Graph graph, Object start)
start
, including the
start
node itself.public static List getSinkNodes(Graph gg)
gg
that have no outgoing edges.
public static void printTree(Tree tree, GraphFormatter fmtr, PrintWriter writer)
public static void printGraph(Graph graph, GraphFormatter fmtr, PrintWriter writer)
printTree(Tree, GraphFormatter, PrintWriter)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |