| Constructor and Description |
|---|
DFSTree(V root) |
DFSTree(V root,
int[] numbering,
java.util.List<E> treeEdges,
java.util.List<E> backEdges,
java.util.List<V> vertices) |
| Modifier and Type | Method and Description |
|---|---|
void |
addTreeEdge(E e) |
void |
addVertex(V v,
int index)
Adds vertex with the provided index to the tree
|
java.util.List<V> |
allDescendantsOf(V v,
boolean includeVertex)
Returns all vertices that are descendants of vertex v in the tree
|
java.util.LinkedList<E> |
allEdges(V v)
All edges leaving or entering the given vertex
|
java.util.List<E> |
allIncomingBackEdges(V v)
Finds all back edges entering the given vertex
|
java.util.List<E> |
allOutgoingEdges(V v)
Finds all edges (tree and back) leaving the given vertex
|
java.util.List<E> |
allOutgoingTreeEdges(V v)
Finds all edges starting from v and ending in a descendant of v (index of v is lower)
|
java.util.List<V> |
directDescendantsOf(V v)
Finds all direct descendants of a given vertex.
|
java.util.List<Path<V,E>> |
findAllPathsDFS(V first,
V target)
Finds all paths between the given two vertices using DFS
|
void |
formBackEdges(java.util.List<E> allEdges)
Separates back edges
|
java.util.List<E> |
getAllEdges() |
java.util.List<E> |
getBackEdges() |
E |
getHighestReturningEdge(E e)
Finds the highest returning edge of a given edge
|
int |
getIndex(V v) |
V |
getRoot() |
java.util.List<E> |
getTreeEdges() |
java.util.Map<V,java.lang.Integer> |
getVerticesWithIndexes() |
int |
highpt(E e)
Finds the highpoint of the given edge
The highpt of an edge (v, w) is its highest
return point (or v if none exists).
|
int |
highpt(V v)
Finds the highpoint of a vertex
Highpoint of a vertex is the highest DFS index of an ancestor of v
reachable through a back edge from a descendant of v
|
E |
incomingEdge(V v)
Finds the incoming edge (starting from an ancestor of v (edge with lower index) and ending in v)
|
V |
leastAncestor(V v)
Vertex directly adjacent to v by a back edge that has the lowest index of all
such vertices
|
int |
lowpt(E e)
Finds the lowpoint of the given edge
The lowpt of an edge (v, w) is its lowest
return point (or w if none exists).
|
int |
lowpt(V v)
Finds the lowpoint of a vertex
The lowpoint of a vertex v, denoted by lowpt(v), is the lowest DFS index of
an ancestor of v reachable through a back edge from a descendant of v
|
int[] |
lowpts(V v)
Finds both lowpt1 and lowpt2 of a vertex
The lowpoint of a vertex v, denoted by lowpt(v), is the lowest DFS index of
an ancestor of v reachable through a back edge from a descendant of v
lowpt1 is the lowest index, lowpt2 is the second lowest
|
java.util.List<E> |
returningEdges(E e)
Finds all returning edges of a given edge
Given a tree edge e = (u, v), its returning edges are those back
edges that from a descendant of v (included v itself ) go to an ancestor of u different from u
itself.
|
void |
setRoot(V root) |
java.lang.String |
toString() |
java.util.List<E> |
treeEdgesBetween(V first,
V target)
Finds all tree edges between the given two vertices
|
java.util.List<V> |
treePathBetween(V first,
V target)
Finds a tree path (presented as a list of vertices belonging to it)
between the two given vertices
|
addEdge, addVertex, addVertex, addVertexBeginning, adjacencyMatrix, adjacentEdges, adjacentVertices, edgeBetween, edgeesBetween, edgesBetween, equals, getAdjacentLists, getAllSelfLoopEdges, getAllSinks, getAllSources, getEdges, getTreeLeaves, getVertexByContent, getVertices, graphMaxDegree, hasEdge, hashCode, hasSelfLoopEdges, hasVertex, inDegree, inEdges, isBiconnected, isConnected, isConnected, isCyclic, isDirected, isRing, isSimple, isSink, isSource, isTree, listBiconnectedComponents, listCutVertices, listMultiEdges, outDegree, outEdges, printAdjacencyMatrix, removeEdge, removeVertex, setDirected, setEdges, setVertices, subgraph, vertexDegreepublic DFSTree(V root)
public void formBackEdges(java.util.List<E> allEdges)
allEdges - All edges of the treepublic int getIndex(V v)
v - Vertexpublic void addVertex(V v, int index)
v - Vertexindex - Indexpublic void addTreeEdge(E e)
public java.util.LinkedList<E> allEdges(V v)
Graphpublic E incomingEdge(V v)
v - Vertexvpublic java.util.List<E> allIncomingBackEdges(V v)
v - Vertexvpublic java.util.List<E> allOutgoingTreeEdges(V v)
v - Vertexvpublic java.util.List<E> allOutgoingEdges(V v)
v - Vertexvpublic java.util.List<V> allDescendantsOf(V v, boolean includeVertex)
v - VertexincludeVertex - Specifies if the vertex itself should be in the list of descendantsvpublic java.util.List<V> directDescendantsOf(V v)
v - Vertexvpublic int lowpt(V v)
v - Vertexv if there are back edges leading form descendant to ancestor of v, -1 otherwisepublic int[] lowpts(V v)
v - Vertexpublic int highpt(V v)
v - Vertexv if there are back edges leading form descendant to ancestor of v, -1 otherwisepublic int lowpt(E e)
e - Edgeepublic int highpt(E e)
e - Edgeepublic java.util.List<E> returningEdges(E e)
e - Edgeepublic E getHighestReturningEdge(E e)
e - Edgeepublic V leastAncestor(V v)
v - Vertexv if one exists, null otherwisepublic java.util.List<E> treeEdgesBetween(V first, V target)
first - The source vertextarget - The target (destination) vertexfirst and targetpublic java.util.List<V> treePathBetween(V first, V target)
first - The source vertextarget - The target (destination) vertexfirst and targetpublic java.util.List<Path<V,E>> findAllPathsDFS(V first, V target)
first - The source vertextarget - The target (destination) vertexfirst and targetpublic V getRoot()
public void setRoot(V root)
root - Root to setpublic java.util.Map<V,java.lang.Integer> getVerticesWithIndexes()
public java.util.List<E> getTreeEdges()
public java.util.List<E> getBackEdges()
public java.util.List<E> getAllEdges()