public abstract class AbstractSparseVertex extends AbstractArchetypeVertex implements Vertex, java.lang.Cloneable
Vertex
interface to minimize the effort required to implement this interface.
It is appropriate for sparse graphs (those in which each vertex
is connected to only a few other vertices); for dense graphs (those in
which each vertex is connected to most other vertices), another
implementation might be more appropriate.
This class extends UserData
, which provides storage and
retrieval mechanisms for user-defined data for each edge instance.
This allows users to attach data to edges without having to extend
this class.
AbstractSparseGraph
,
AbstractSparseEdge
UserDataContainer.CopyAction
id, m_Graph
factory, udc_delegate
Modifier | Constructor and Description |
---|---|
protected |
AbstractSparseVertex()
Creates a new instance of a vertex for inclusion
in a sparse graph.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
addNeighbor_internal(Edge e,
Vertex v)
Adds the specified edge
e and vertex v
to the internal data structures of this vertex. |
ArchetypeVertex |
copy(ArchetypeGraph newGraph)
Creates a copy of this vertex in graph
g . |
ArchetypeEdge |
findEdge(ArchetypeVertex v)
Returns an edge that connects this vertex to
v . |
Edge |
findEdge(Vertex v)
Returns the edge that connects this vertex to the specified
vertex
v . |
java.util.Set |
findEdgeSet(ArchetypeVertex v)
Returns the set of all edges that connect this vertex
with the specified vertex
v . |
java.util.Set |
findEdgeSet(Vertex v)
Returns the set of all edges that connect this vertex
with the specified vertex
v . |
protected abstract void |
removeNeighbor_internal(Edge e,
Vertex v)
Removes the specified edge
e and vertex v
from the internal data structures of this vertex. |
java.lang.String |
toString()
Returns a human-readable representation of this vertex.
|
degree, equals, getEdges_internal, getEqualVertex, getEquivalentVertex, getIncidentEdges, getIncidentElements, getNeighbors_internal, getNeighbors, isIncident, isNeighborOf, numNeighbors
addGraph_internal, getGraph, hashCode, initialize, removeGraph_internal
addUserDatum, clone, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDataFactory, setUserDatum
finalize, getClass, notify, notifyAll, wait, wait, wait
getInEdges, getOutEdges, getPredecessors, getSuccessors, inDegree, isDest, isPredecessorOf, isSource, isSuccessorOf, numPredecessors, numSuccessors, outDegree
degree, getEqualVertex, getEquivalentVertex, getIncidentEdges, getNeighbors, isIncident, isNeighborOf, numNeighbors
getGraph, getIncidentElements
addUserDatum, clone, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum
protected AbstractSparseVertex()
AbstractElement.initialize()
public Edge findEdge(Vertex v)
v
. This is a
simple implementation which checks the opposite vertex of
each outgoing edge of this vertex; this solution is general,
but not efficient.findEdge
in interface Vertex
Vertex.findEdge(Vertex)
public ArchetypeEdge findEdge(ArchetypeVertex v)
ArchetypeVertex
v
.
If this edge is not uniquely
defined (that is, if the graph contains more than one edge connecting
this vertex to v
), any of these edges
v
may be returned. findEdgeSet(v)
may be
used to return all such edges.
If v
is not connected to this vertex, returns
null
.findEdge
in interface ArchetypeVertex
findEdge
in class AbstractArchetypeVertex
ArchetypeVertex.findEdge(edu.uci.ics.jung.graph.ArchetypeVertex)
public java.util.Set findEdgeSet(Vertex v)
Vertex
v
. Each edge in this set
will be either a directed outgoing edge from this vertex to
v
, or an undirected edge connecting this vertex to
v
. findEdge(v)
may be used to return
a single (arbitrary) element of this set.
If v
is not connected to this vertex, returns an empty Set
.findEdgeSet
in interface Vertex
Vertex.findEdgeSet(Vertex)
public java.util.Set findEdgeSet(ArchetypeVertex v)
ArchetypeVertex
v
.
findEdge(v)
may be used to return
a single (arbitrary) element of this set.
If v
is not connected to this vertex, returns an empty Set
.findEdgeSet
in interface ArchetypeVertex
findEdgeSet
in class AbstractArchetypeVertex
ArchetypeVertex.findEdgeSet(ArchetypeVertex)
public ArchetypeVertex copy(ArchetypeGraph newGraph)
ArchetypeVertex
g
. The vertex
created will be equivalent to this vertex: given
v = this.copy(g)
, then
this.getEquivalentVertex(g) == v
, and
this.equals(v) == true
.copy
in interface ArchetypeVertex
copy
in class AbstractArchetypeVertex
newGraph
- the graph in which the copied vertex will be placedArchetypeVertex.copy(ArchetypeGraph)
protected abstract void addNeighbor_internal(Edge e, Vertex v)
e
and vertex v
to the internal data structures of this vertex.e
- the new incident edge of this vertexv
- the new neighbor of this vertexprotected abstract void removeNeighbor_internal(Edge e, Vertex v)
e
and vertex v
from the internal data structures of this vertex.e
- the incident edge of this vertex which is being removedv
- the neighbor of this vertex which is being removedpublic java.lang.String toString()
toString
in class java.lang.Object
Object.toString()