|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jpaul.Graphs.DiGraph<Vertex> jpaul.Graphs.LabeledDiGraph<Vertex,Label>
public abstract class LabeledDiGraph<Vertex,Label>
LabeledDiGraph
models a labeled directed graph. This is a
DiGraph
where each arc has a label. Similar to a
DiGraph
, a LabeledDiGraph
is defined by giving a set
of roots and a navigator to iterate over the (labeled) arcs. The
vertices from the LabeledDiGraph
are those vertices that are
reachable from the roots by following the forward arcs given by the
navigator.
An LabeledDiGraph
is trivially a DiGraph
: it
is enough to strip the labels off the arcs. All the algorithms for
a DiGraph
can be used for a LabeledDiGraph
.
DiGraph
Nested Class Summary | |
---|---|
static class |
LabeledDiGraph.LabeledBiDiNavigator<Vertex,Label>
Bidirectional iterator into a labeled graph. |
static class |
LabeledDiGraph.LabeledForwardNavigator<Vertex,Label>
Forward iterator into a labeled graph. |
Field Summary |
---|
Fields inherited from class jpaul.Graphs.DiGraph |
---|
CACHING |
Constructor Summary | |
---|---|
LabeledDiGraph()
Creates a LabeledDiGraph . |
|
LabeledDiGraph(boolean CACHING)
Creates a LabeledDiGraph . |
Method Summary | |
---|---|
ForwardNavigator<Vertex> |
getForwardNavigator()
Returns the forward navigator for this digraph. |
LabeledDiGraph.LabeledBiDiNavigator<Vertex,Label> |
getLabeledBiDiNavigator()
Returns a bi-directional labeled navigator through LabeledDiGraph . |
LabeledDiGraph.LabeledForwardNavigator<Vertex,Label> |
getLabeledForwardNavigator()
Returns a forward labeled navigator through this LabeledDiGraph . |
BiDiNavigator<Vertex> |
getNavigator()
Returns the (bi-directional) navigator for this digraph. |
abstract java.util.Collection<Vertex> |
getRoots()
Returns the roots of this directed graph. |
java.lang.String |
toString()
Returns a string representation of this DiGraph. |
Methods inherited from class jpaul.Graphs.DiGraph |
---|
constructBiDiNavigator, dfs, dfs2, diGraph, diGraph, findPath, findPath, findPath, forAllVertices, getBiDiNavigator, getComponentDiGraph, numArcs, numVertices, reverseDiGraph, subDiGraph, transitivePred, transitivePred, transitivePredWithFrontier, transitiveSucc, transitiveSucc, transitiveSuccWithFrontier, union, vertices |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LabeledDiGraph()
LabeledDiGraph
.
public LabeledDiGraph(boolean CACHING)
LabeledDiGraph
.
Method Detail |
---|
public abstract java.util.Collection<Vertex> getRoots()
DiGraph
this
directed graph.
By "roots of a digraph" we mean any set of vertices
such that one can explore the entire graph by (transitively)
navigating on their outgoing arcs (using the next
method of the navigator). Notice that this set is not
uniquely defined; also, it is OK to return ALL the vertices
from the digraph. The caller is not supposed to mutate the
returned collection.
getRoots
in class DiGraph<Vertex>
public LabeledDiGraph.LabeledBiDiNavigator<Vertex,Label> getLabeledBiDiNavigator()
LabeledDiGraph
. The default implementation uses the
forward navigator returned by LabeledForwardNavigator
to traverse the entire graph and construct the list of
backward arcs.
Note: You MUST override at least one of
getLabeledBiDiNavigator
and
getLabeledForwardNavigator
.
public LabeledDiGraph.LabeledForwardNavigator<Vertex,Label> getLabeledForwardNavigator()
LabeledDiGraph
. The default implementation returns the
full navigator produced by getLabeledBiDiNavigator()
.
Note: You MUST override at least one of
getLabeledBiDiNavigator
and
getLabeledForwardNavigator
.
public BiDiNavigator<Vertex> getNavigator()
LabeledDiGraph
s: returns the
same object as getLabeledBiDiNavigator()
.
public ForwardNavigator<Vertex> getForwardNavigator()
LabeledDiGraph
s: returns the
same object as getLabeledForwardNavigator()
.
getForwardNavigator
in class DiGraph<Vertex>
public java.lang.String toString()
DiGraph
this
DiGraph.
This string representation is adequate for debugging small
graphs. For more complex graphs, try to output a dot
representation of the graph and use an external tool to
visualize it.
toString
in class DiGraph<Vertex>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |