|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectedu.uci.ics.jung.utils.UserData
edu.uci.ics.jung.graph.impl.AbstractArchetypeGraph
edu.uci.ics.jung.graph.impl.AbstractSparseGraph
This class provides a skeletal implementation of the Graph
interface to minimize the effort required to implement this interface. This
graph implementation stores vertices and edges in Sets. It is appropriate
for sparse graphs (those in which each vertex has only a few neighbors). For
dense graphs (those in which each vertex is connected to most other
vertices), a different implementation (for example, one which represents a
graph via a matrix) may be more appropriate.
Currently, the addition and removal methods will notify their arguments that
they have been added to or removed from this graph only if they are
instances of AbstractSparseVertex or AbstractSparseEdge.
This class extends UserData, which provides storage and
retrieval mechanisms for user-defined data for each graph instance. This
allows users to attach data to graphs without having to extend this class.
| Nested Class Summary |
| Nested classes inherited from class edu.uci.ics.jung.utils.UserDataContainer |
UserDataContainer.CopyAction |
| Field Summary |
| Fields inherited from class edu.uci.ics.jung.utils.UserData |
CLONE, REMOVE, SHARED |
| Fields inherited from interface edu.uci.ics.jung.graph.Graph |
DIRECTED_EDGE, NOT_PARALLEL_EDGE, SIMPLE_EDGE, UNDIRECTED_EDGE |
| Fields inherited from interface edu.uci.ics.jung.graph.ArchetypeGraph |
SUBSET_MANAGER |
| Constructor Summary | |
AbstractSparseGraph()
Creates an instance of a sparse graph. |
|
| Method Summary | |
Edge |
addEdge(Edge e)
Adds e to this graph, and returns a reference to the
added vertex. |
Vertex |
addVertex(Vertex v)
Adds v to this graph, and returns a reference to the
added vertex. |
java.util.Set |
getEdges()
Returns an unmodifiable set view of the edges in this graph. |
java.util.Set |
getVertices()
Returns an unmodifiable set view of the vertices in this graph. |
boolean |
isDirected()
Returns true if each edge of this graph is directed,
and false if each edge of this graph is undirected.
|
void |
removeAllEdges()
Removes all edges from this graph. |
void |
removeAllVertices()
Removes all vertices (and, therefore, all edges) from this graph. |
void |
removeEdge(Edge e)
Removes the edge from the graph, and notifies that the edge and its incident vertices that it has been removed. |
void |
removeEdges(java.util.Set edges)
Removes all edges in the specified set from this graph. |
void |
removeVertex(Vertex v)
Removes all edges adjacent to the specified vertex, removes the vertex, and notifies the vertex that it has been removed. |
void |
removeVertices(java.util.Set vertices)
Removes all vertices in the specified set from this graph. |
| Methods inherited from class edu.uci.ics.jung.graph.impl.AbstractArchetypeGraph |
addListener, copy, getEdgeConstraints, getVertexConstraints, newInstance, numEdges, numVertices, removeListener, toString |
| Methods inherited from class edu.uci.ics.jung.utils.UserData |
addUserDatum, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface edu.uci.ics.jung.graph.ArchetypeGraph |
addListener, copy, getEdgeConstraints, getVertexConstraints, newInstance, numEdges, numVertices, removeListener |
| Methods inherited from interface edu.uci.ics.jung.utils.UserDataContainer |
addUserDatum, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum |
| Constructor Detail |
public AbstractSparseGraph()
initialize()
to set up the local data structures.
#initialize()| Method Detail |
public java.util.Set getVertices()
getVertices in interface ArchetypeGraphArchetypeGraph.getVertices(),
Collections.unmodifiableSet(java.util.Set)public java.util.Set getEdges()
getEdges in interface ArchetypeGraphArchetypeGraph.getEdges(),
Collections.unmodifiableSet(java.util.Set)public Edge addEdge(Edge e)
Graphe to this graph, and returns a reference to the
added vertex.
addEdge in interface Graphe - the edge to be addedGraph.addEdge(edu.uci.ics.jung.graph.Edge)public Vertex addVertex(Vertex v)
Graphv to this graph, and returns a reference to the
added vertex.
addVertex in interface Graphv - the vertex to be addedGraph.addVertex(edu.uci.ics.jung.graph.Vertex)public void removeVertex(Vertex v)
AbstractSparseVertex.
removeVertex in interface Graphpublic void removeEdge(Edge e)
AbstractSparseEdge,
and the incident vertices will not be notified unless they are instances
of AbstractSparseVertex.
removeEdge in interface Graphpublic void removeVertices(java.util.Set vertices)
removeVertex on all elements
of the set.
removeVertices in interface ArchetypeGraphvertices - the set of vertices to be removedArchetypeGraph.removeVertices(java.util.Set)public void removeEdges(java.util.Set edges)
removeEdge on all elements of the
set.
removeEdges in interface ArchetypeGraphArchetypeGraph.removeEdges(java.util.Set)public void removeAllVertices()
removeVertex on all
vertices of this graph.
removeAllVertices in interface ArchetypeGraphArchetypeGraph.removeAllVertices()public void removeAllEdges()
removeEdge on all edges of this graph.
removeAllEdges in interface ArchetypeGraphArchetypeGraph.removeAllEdges()public boolean isDirected()
Graphtrue if each edge of this graph is directed,
and false if each edge of this graph is undirected.
If some edges are directed and some are not, throws
FatalException.
isDirected in interface GraphGraph.isDirected()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||