package edu.uci.ics.jung.graph;
import java.util.Collection;
/**
* An interface for a graph which consists of a collection of rooted
* directed acyclic graphs.
*
* @author Joshua O'Madadhain
*/
public interface Forest extends DirectedGraph {
/**
* Returns a view of this graph as a collection of Tree instances.
* @return a view of this graph as a collection of Trees
*/
Collection> getTrees();
/**
* Returns the parent of 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().
*
* @param vertex the vertex whose parent is to be returned
* @return the parent of vertex in this tree
* @see Graph#getPredecessors(Object)
* @see #getParentEdge(Object)
*/
public V getParent(V vertex);
/**
* Returns the edge connecting 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)).
*
* @param vertex the vertex whose incoming edge is to be returned
* @return the edge connecting vertex to its parent, or
* null if vertex is the root
*
* @see Graph#getInEdges(Object)
* @see #getParent(Object)
*/
public E getParentEdge(V vertex);
/**
* Returns the children of 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).
* @param vertex the vertex whose children are to be returned
* @return the Collection of children of vertex
* in this tree
* @see Graph#getSuccessors(Object)
* @see #getChildEdges(Object)
*/
public Collection getChildren(V vertex);
/**
* Returns the edges connecting 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).
* @param vertex the vertex whose child edges are to be returned
* @return the Collection of edges connecting
* vertex to its children in this tree
* @see Graph#getOutEdges(Object)
* @see #getChildren(Object)
*/
public Collection getChildEdges(V vertex);
/**
* Returns the number of children that 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).
* @param vertex the vertex whose child edges are to be returned
* @return the Collection of edges connecting
* vertex to its children in this tree
* @see #getChildEdges(Object)
* @see #getChildren(Object)
* @see Graph#getSuccessorCount(Object)
*/
public int getChildCount(V vertex);
}
Ads help maintain this website.