Package edu.uci.ics.jung.graph.util
Class Graphs.UnmodifiableForest<V,E>
- java.lang.Object
-
- edu.uci.ics.jung.graph.util.Graphs.UnmodifiableAbstractGraph<V,E>
-
- edu.uci.ics.jung.graph.util.Graphs.UnmodifiableGraph<V,E>
-
- edu.uci.ics.jung.graph.util.Graphs.UnmodifiableForest<V,E>
-
- All Implemented Interfaces:
DirectedGraph<V,E>
,Forest<V,E>
,Graph<V,E>
,Hypergraph<V,E>
,java.io.Serializable
- Direct Known Subclasses:
Graphs.UnmodifiableTree
- Enclosing class:
- Graphs
static class Graphs.UnmodifiableForest<V,E> extends Graphs.UnmodifiableGraph<V,E> implements Forest<V,E>, java.io.Serializable
-
-
Field Summary
-
Fields inherited from class edu.uci.ics.jung.graph.util.Graphs.UnmodifiableAbstractGraph
delegate
-
-
Constructor Summary
Constructors Modifier Constructor Description private
UnmodifiableForest(Forest<V,E> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getChildCount(V vertex)
Returns the number of children thatvertex
has in this tree.java.util.Collection<E>
getChildEdges(V vertex)
Returns the edges connectingvertex
to its children in this tree.java.util.Collection<V>
getChildren(V vertex)
Returns the children ofvertex
in this tree.V
getParent(V vertex)
Returns the parent ofvertex
in this tree.E
getParentEdge(V vertex)
Returns the edge connectingvertex
to its parent in this tree.java.util.Collection<Tree<V,E>>
getTrees()
Returns a view of this graph as a collection ofTree
instances.-
Methods inherited from class edu.uci.ics.jung.graph.util.Graphs.UnmodifiableAbstractGraph
addEdge, addEdge, addEdge, addEdge, addVertex, containsEdge, containsVertex, degree, findEdge, findEdgeSet, getDefaultEdgeType, getDest, getEdgeCount, getEdgeCount, getEdges, getEdges, getEdgeType, getEndpoints, getIncidentCount, getIncidentEdges, getIncidentVertices, getInEdges, getNeighborCount, getNeighbors, getOpposite, getOutEdges, getPredecessorCount, getPredecessors, getSource, getSuccessorCount, getSuccessors, getVertexCount, getVertices, inDegree, isDest, isIncident, isNeighbor, isPredecessor, isSource, isSuccessor, outDegree, removeEdge, removeVertex
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
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 Detail
-
getTrees
public java.util.Collection<Tree<V,E>> getTrees()
Description copied from interface:Forest
Returns a view of this graph as a collection ofTree
instances.
-
getChildCount
public int getChildCount(V vertex)
Description copied from interface:Forest
Returns the number of children thatvertex
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 forgetSuccessorCount(vertex)
.- Specified by:
getChildCount
in interfaceForest<V,E>
- Parameters:
vertex
- the vertex whose child edges are to be returned- Returns:
- the
Collection
of edges connectingvertex
to its children in this tree - See Also:
Forest.getChildEdges(Object)
,Forest.getChildren(Object)
,Graph.getSuccessorCount(Object)
-
getChildEdges
public java.util.Collection<E> getChildEdges(V vertex)
Description copied from interface:Forest
Returns the edges connectingvertex
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 forgetOutEdges(vertex)
.- Specified by:
getChildEdges
in interfaceForest<V,E>
- Parameters:
vertex
- the vertex whose child edges are to be returned- Returns:
- the
Collection
of edges connectingvertex
to its children in this tree - See Also:
Graph.getOutEdges(Object)
,Forest.getChildren(Object)
-
getChildren
public java.util.Collection<V> getChildren(V vertex)
Description copied from interface:Forest
Returns the children ofvertex
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 forgetSuccessors(vertex)
.- Specified by:
getChildren
in interfaceForest<V,E>
- Parameters:
vertex
- the vertex whose children are to be returned- Returns:
- the
Collection
of children ofvertex
in this tree - See Also:
Graph.getSuccessors(Object)
,Forest.getChildEdges(Object)
-
getParent
public V getParent(V vertex)
Description copied from interface:Forest
Returns the parent ofvertex
in this tree. (Ifvertex
is the root, returnsnull
.) 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 toGraph.getPredecessors(vertex).iterator().next()
.- Specified by:
getParent
in interfaceForest<V,E>
- Parameters:
vertex
- the vertex whose parent is to be returned- Returns:
- the parent of
vertex
in this tree - See Also:
Graph.getPredecessors(Object)
,Forest.getParentEdge(Object)
-
getParentEdge
public E getParentEdge(V vertex)
Description copied from interface:Forest
Returns the edge connectingvertex
to its parent in this tree. (Ifvertex
is the root, returnsnull
.) 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 toGraph.getInEdges(vertex).iterator().next()
, and also toGraph.findEdge(vertex, getParent(vertex))
.- Specified by:
getParentEdge
in interfaceForest<V,E>
- Parameters:
vertex
- the vertex whose incoming edge is to be returned- Returns:
- the edge connecting
vertex
to its parent, ornull
ifvertex
is the root - See Also:
Graph.getInEdges(Object)
,Forest.getParent(Object)
-
-