Package edu.uci.ics.jung.graph
Interface Tree<V,E>
- All Superinterfaces:
DirectedGraph<V,
,E> Forest<V,
,E> Graph<V,
,E> Hypergraph<V,
E>
- All Known Implementing Classes:
DelegateTree
,Graphs.SynchronizedTree
,Graphs.UnmodifiableTree
,OrderedKAryTree
A subtype of
Graph
which is a (directed, rooted) tree.
What we refer to as a "tree" here is actually (in the terminology of graph theory) a
rooted tree. (That is, there is a designated single vertex--the root--from which we measure
the shortest path to each vertex, which we call its depth; the maximum over all such
depths is the tree's height. Note that for a tree, there is exactly
one unique path from the root to any vertex.)-
Method Summary
Methods inherited from interface edu.uci.ics.jung.graph.Forest
getChildCount, getChildEdges, getChildren, getParent, getParentEdge, getTrees
Methods inherited from interface edu.uci.ics.jung.graph.Graph
addEdge, addEdge, getDest, getEndpoints, getInEdges, getOpposite, getOutEdges, getPredecessorCount, getPredecessors, getSource, getSuccessorCount, getSuccessors, inDegree, isDest, isPredecessor, isSource, isSuccessor, outDegree
Methods inherited from interface edu.uci.ics.jung.graph.Hypergraph
addEdge, addEdge, addVertex, containsEdge, containsVertex, degree, findEdge, findEdgeSet, getDefaultEdgeType, getEdgeCount, getEdgeCount, getEdges, getEdges, getEdgeType, getIncidentCount, getIncidentEdges, getIncidentVertices, getNeighborCount, getNeighbors, getVertexCount, getVertices, isIncident, isNeighbor, removeEdge, removeVertex
-
Method Details
-
getDepth
Returns the (unweighted) distance ofvertex
from the root of this tree.- Parameters:
vertex
- the vertex whose depth is to be returned.- Returns:
- the length of the shortest unweighted path
from
vertex
to the root of this tree - See Also:
-
getHeight
int getHeight()Returns the maximum depth in this tree.- Returns:
- the maximum depth in this tree
- See Also:
-
getRoot
V getRoot()Returns the root of this tree. The root is defined to be the vertex (designated either at the tree's creation time, or as the first vertex to be added) with respect to which vertex depth is measured.- Returns:
- the root of this tree
-