public class SparseTree extends SparseGraph implements DirectedGraph
Graph
that consists of a
Vertex
set and a DirectedEdge
set.
Further, a vertex can have no more than one incoming directed
edge (enforced with TreePredicate
); the tree must
define a root vertex at construction time.
This implementation does NOT ALLOW parallel edges.
SimpleDirectedSparseVertex
is the most efficient
vertex for this graph type.
Edge constraints imposed by this class: DIRECTED_EDGE,
TreePredicate
, NOT_PARALLEL_EDGE
For additional system and user constraints defined for this class, see the superclasses of this class.
DirectedSparseVertex
,
DirectedSparseEdge
AbstractArchetypeGraph.Requirements
UserDataContainer.CopyAction
Modifier and Type | Field and Description |
---|---|
static java.lang.Object |
IN_TREE_KEY |
protected Vertex |
mRoot |
static java.lang.Object |
SPARSE_ROOT_KEY |
mEdges, mVertices
edge_requirements, mEdgeIDs, mGraphListenerHandler, mVertexIDs, vertex_requirements
factory, udc_delegate
DIRECTED_EDGE, NOT_PARALLEL_EDGE, SIMPLE_EDGE, UNDIRECTED_EDGE
SUBSET_MANAGER
Constructor and Description |
---|
SparseTree(Vertex root) |
Modifier and Type | Method and Description |
---|---|
Edge |
addEdge(Edge e)
Adds
e to this graph, and returns a reference to the
added vertex. |
Vertex |
getRoot() |
addVertex, getEdges, getVertices, initialize, isDirected, removeEdge, removeEdges, removeVertex, removeVertices
addAllNotInitializers, addListener, checkConstraints, copy, getEdgeConstraints, getVertexConstraints, listenersExist, newInstance, numEdges, numVertices, removeAllEdges, removeAllVertices, removeListener, toString
addUserDatum, clone, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDataFactory, setUserDatum
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addVertex, isDirected, removeEdge, removeVertex
addListener, copy, getEdgeConstraints, getEdges, getVertexConstraints, getVertices, newInstance, numEdges, numVertices, removeAllEdges, removeAllVertices, removeEdges, removeListener, removeVertices
addUserDatum, clone, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum
protected Vertex mRoot
public static final java.lang.Object SPARSE_ROOT_KEY
public static final java.lang.Object IN_TREE_KEY
public SparseTree(Vertex root)
root
- public Vertex getRoot()
public Edge addEdge(Edge e)
Graph
e
to this graph, and returns a reference to the
added vertex.addEdge
in interface Graph
addEdge
in class AbstractSparseGraph
e
- the edge to be addedGraph.addEdge(edu.uci.ics.jung.graph.Edge)