|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A interface for vertex implementations in generalized graphs.
Vertices are added to graphs in a two-stage process. First
the user calls the vertex constructor, yielding an instance,
v
, of ArchetypeVertex
. Then the user
calls g.addVertex(v)
, where g
is an
implementation of ArchetypeGraph
.
The two-stage nature of this process makes it possible to create "orphaned"
vertices that are not part of a graph.
This was done as a compromise between common practices in Java APIs
regarding the side effects of constructors, and the semantics of graphs.
However, the behavior of all ArchetypeVertex
methods, with
the exception of getGraph()
, is unspecified on orphaned vertices.
The JUNG Project implementations will never create orphaned
vertices, and we strongly recommend that users follow this practice
by nesting the constructor call inside the call to addVertex()
,
as in the following example:
g.addVertex(new VertexType());
where VertexType
is the type of vertex that the user wishes
to create.
ArchetypeEdge
,
ArchetypeGraph
Nested Class Summary |
Nested classes inherited from class edu.uci.ics.jung.utils.UserDataContainer |
UserDataContainer.CopyAction |
Method Summary | |
ArchetypeVertex |
copy(ArchetypeGraph g)
Creates a copy of this vertex in graph g . |
int |
degree()
Returns the number of edges incident to this vertex. |
ArchetypeVertex |
getEqualVertex(ArchetypeGraph g)
Returns the vertex in graph g , if any, that is
equal to this vertex. |
ArchetypeVertex |
getEquivalentVertex(ArchetypeGraph g)
Deprecated. As of version 1.4, renamed to getEqualVertex(g). |
ArchetypeGraph |
getGraph()
Returns a reference to the graph that contains this vertex. |
java.util.Set |
getIncidentEdges()
Returns the set of edges which are incident to this vertex. |
java.util.Set |
getNeighbors()
Returns the set of vertices which are connected to this vertex via edges; each of these vertices should implement ArchetypeVertex .
|
boolean |
isIncident(ArchetypeEdge e)
Returns true if the specified edge e is
incident to this vertex, and false otherwise.
|
boolean |
isNeighborOf(ArchetypeVertex v)
Returns true if the specified vertex v and
this vertex are each incident
to one or more of the same edges, and false otherwise.
|
int |
numNeighbors()
Returns the number of neighbors that this vertex has. |
Methods inherited from interface edu.uci.ics.jung.utils.UserDataContainer |
addUserDatum, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum |
Method Detail |
public ArchetypeGraph getGraph()
public java.util.Set getNeighbors()
ArchetypeVertex
.
If this vertex is connected to itself with a self-loop, then
this vertex will be included in its own neighbor set.
public java.util.Set getIncidentEdges()
ArchetypeEdge
.
public int degree()
numNeighbors()
public int numNeighbors()
degree()
public ArchetypeVertex getEqualVertex(ArchetypeGraph g)
g
, if any, that is
equal to this vertex. Otherwise, returns null.
Two vertices are equal if one of them is an ancestor (via
copy()
) of the other.
copy(ArchetypeGraph)
,
ArchetypeEdge.getEqualEdge(ArchetypeGraph)
public ArchetypeVertex getEquivalentVertex(ArchetypeGraph g)
public boolean isNeighborOf(ArchetypeVertex v)
true
if the specified vertex v
and
this vertex are each incident
to one or more of the same edges, and false
otherwise.
The behavior of this method is undefined if v
is not
an element of this vertex's graph.
public boolean isIncident(ArchetypeEdge e)
true
if the specified edge e
is
incident to this vertex, and false
otherwise.
The behavior of this method is undefined if e
is not
an element of this vertex's graph.
public ArchetypeVertex copy(ArchetypeGraph g)
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
.
g
- the graph in which the copied vertex will be placed
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |