public interface Forest<V,E> extends DirectedGraph<V,E>
Modifier and Type | Method and Description |
---|---|
int |
getChildCount(V vertex)
Returns the number of children that
vertex has in this tree. |
java.util.Collection<E> |
getChildEdges(V vertex)
Returns the edges connecting
vertex to its children
in this tree. |
java.util.Collection<V> |
getChildren(V vertex)
Returns the children of
vertex in this tree. |
V |
getParent(V vertex)
Returns the parent of
vertex in this tree. |
E |
getParentEdge(V vertex)
Returns the edge connecting
vertex to its parent in
this tree. |
java.util.Collection<Tree<V,E>> |
getTrees()
Returns a view of this graph as a collection of
Tree instances. |
addEdge, addEdge, getDest, getEndpoints, getInEdges, getOpposite, getOutEdges, getPredecessorCount, getPredecessors, getSource, getSuccessorCount, getSuccessors, inDegree, isDest, isPredecessor, isSource, isSuccessor, outDegree
addEdgeWithVertices, addEdgeWithVertices, addVertex, containsEdge, containsVertex, degree, findEdge, findEdgeSet, getDefaultEdgeType, getEdgeCount, getEdgeCount, getEdges, getEdgesView, getEdgeType, getIncidentCount, getIncidentEdges, getIncidentVertices, getNeighborCount, getNeighbors, getVertexCount, getVerticesView, isIncident, isNeighbor, removeEdge, removeVertex
java.util.Collection<Tree<V,E>> getTrees()
Tree
instances.Tree
sV getParent(V vertex)
vertex
in this tree.
(If vertex
is the root, returns null
.)
The parent of a vertex is defined as being its predecessor in the
(unique) shortest path from the root to this vertex.
This is a convenience method which is equivalent to
Graph.getPredecessors(vertex).iterator().next()
.vertex
in this treeGraph.getPredecessors(Object)
,
getParentEdge(Object)
E getParentEdge(V vertex)
vertex
to its parent in
this tree.
(If vertex
is the root, returns null
.)
The parent of a vertex is defined as being its predecessor in the
(unique) shortest path from the root to this vertex.
This is a convenience method which is equivalent to
Graph.getInEdges(vertex).iterator().next()
,
and also to Graph.findEdge(vertex, getParent(vertex))
.vertex
to its parent, or
null
if vertex
is the rootGraph.getInEdges(Object)
,
getParent(Object)
java.util.Collection<V> getChildren(V vertex)
vertex
in this tree.
The children of a vertex are defined as being the successors of
that vertex on the respective (unique) shortest paths from the root to
those vertices.
This is syntactic (maple) sugar for getSuccessors(vertex)
.vertex
- the vertex whose children are to be returnedCollection
of children of vertex
in this treeGraph.getSuccessors(Object)
,
getChildEdges(Object)
java.util.Collection<E> getChildEdges(V vertex)
vertex
to its children
in this tree.
The children of a vertex are defined as being the successors of
that vertex on the respective (unique) shortest paths from the root to
those vertices.
This is syntactic (maple) sugar for getOutEdges(vertex)
.vertex
- the vertex whose child edges are to be returnedCollection
of edges connecting
vertex
to its children in this treeGraph.getOutEdges(Object)
,
getChildren(Object)
int getChildCount(V vertex)
vertex
has in this tree.
The children of a vertex are defined as being the successors of
that vertex on the respective (unique) shortest paths from the root to
those vertices.
This is syntactic (maple) sugar for getSuccessorCount(vertex)
.vertex
- the vertex whose child edges are to be returnedCollection
of edges connecting
vertex
to its children in this treegetChildEdges(Object)
,
getChildren(Object)
,
Graph.getSuccessorCount(Object)
Copyright © 2021, 2022 Herve Girod. All Rights Reserved. Documentation and source under the BSD 3-Clause licence