public interface Vertex extends ArchetypeVertex
ArchetypeVertex
that can be connected
by instances of Edge
.
A vertex may be connected to other vertices by directed or undirected
edges. A DirectedEdge
has a source Vertex
and
a (distinct) destination Vertex
. An
UndirectedEdge
treats each incident Vertex
as
if it were both source and destination for that edge:
UndirectedGraph g; Vertex v1, v2; ... Edge e = g.addEdge(new UndirectedSparseEdge(v1, v2)); g.addEdge(e); v1.isSource(e); // evaluates to true v2.isSource(e); // evaluates to true v1.isDest(e); // evaluates to true v2.isDest(e); // evaluates to trueFor this reason, an
UndirectedEdge
which is incident to a Vertex
is considered to be both an incoming and an outgoing edge of that vertex.
Therefore two instances of Vertex
which are connected
by an UndirectedEdge
are mutually successors of and
predecessors of each other:
v1.isPredecessorOf(v2); // evaluates to true v2.isPredecessorOf(v1); // evaluates to true v1.isSuccessorOf(v2); // evaluates to true v2.isSuccessorOf(v1); // evaluates to true
Graph
,
Edge
,
UndirectedEdge
,
DirectedEdge
UserDataContainer.CopyAction
Modifier and Type | Method and Description |
---|---|
Edge |
findEdge(Vertex v)
Returns a directed outgoing edge from this vertex to
v ,
or an undirected edge that connects this vertex to v . |
java.util.Set |
findEdgeSet(Vertex v)
Returns the set of all edges that connect this vertex
with the specified vertex
v . |
java.util.Set |
getInEdges()
Returns the set of incoming edges of this vertex.
|
java.util.Set |
getOutEdges()
Returns the set of outgoing edges of this vertex.
|
java.util.Set |
getPredecessors()
Returns the set of predecessors of this vertex.
|
java.util.Set |
getSuccessors()
Returns the set of successors of this vertex.
|
int |
inDegree()
Returns the number of incoming edges that are incident to this
vertex.
|
boolean |
isDest(Edge e)
Returns
true if this vertex is a destination of
the specified edge e , and false otherwise. |
boolean |
isPredecessorOf(Vertex v)
Returns
true if this vertex is a predecessor of
the specified vertex v , and false otherwise. |
boolean |
isSource(Edge e)
Returns
true if this vertex is a source of
the specified edge e , and false otherwise. |
boolean |
isSuccessorOf(Vertex v)
Returns
true if this vertex is a successor of
the specified vertex v , and false otherwise. |
int |
numPredecessors()
Returns the number of predecessors of this vertex.
|
int |
numSuccessors()
Returns the number of successors of this vertex.
|
int |
outDegree()
Returns the number of outgoing edges that are incident to this
vertex.
|
copy, degree, findEdge, findEdgeSet, getEqualVertex, getEquivalentVertex, getIncidentEdges, getNeighbors, isIncident, isNeighborOf, numNeighbors
getGraph, getIncidentElements
addUserDatum, clone, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum
java.util.Set getPredecessors()
v
is a predecessor of this vertex if and only if
v.isPredecessorOf(this)
returns true
.
Each element of the set returned should implement Vertex
.ArchetypeVertex.getNeighbors()
,
isPredecessorOf(Vertex)
java.util.Set getSuccessors()
v
is a successor of this vertex if and only if
v.isSuccessorOf(this)
returns true
.
Each element of the set returned should implement Vertex
.ArchetypeVertex.getNeighbors()
,
isSuccessorOf(Vertex)
java.util.Set getInEdges()
e
is an incoming edge of this vertex if and only if
this.isDest(e)
returns true
.
Each element of the set returned should implement Edge
.ArchetypeVertex.getIncidentEdges()
java.util.Set getOutEdges()
e
is an outgoing edge of this vertex if and only if
this.isSource(e)
returns true
.
Each element of the set returned should implement Edge
.ArchetypeVertex.getIncidentEdges()
int inDegree()
getInEdges()
,
ArchetypeVertex.degree()
int outDegree()
getOutEdges()
,
ArchetypeVertex.degree()
int numPredecessors()
getPredecessors()
,
ArchetypeVertex.numNeighbors()
int numSuccessors()
getSuccessors()
,
ArchetypeVertex.numNeighbors()
boolean isSuccessorOf(Vertex v)
true
if this vertex is a successor of
the specified vertex v
, and false
otherwise.
This vertex is a successor of v
if and only if
there exists an edge e
such that
v.isSource(e) == true
and
this.isDest(e) == true
.
The behavior of this method is undefined if v
is not
an element of this vertex's graph.boolean isPredecessorOf(Vertex v)
true
if this vertex is a predecessor of
the specified vertex v
, and false
otherwise.
This vertex is a predecessor of v
if and only if
there exists an edge e
such that
this.isSource(e) == true
and
v.isDest(e) == true
.
The behavior of this method is undefined if v
is not
an element of this vertex's graph.boolean isSource(Edge e)
true
if this vertex is a source of
the specified edge e
, and false
otherwise.
A vertex v
is a source of e
if e
is an outgoing edge of v
.
The behavior of this method is undefined if e
is not
an element of this vertex's graph.boolean isDest(Edge e)
true
if this vertex is a destination of
the specified edge e
, and false
otherwise.
A vertex v
is a destination of e
if e
is an incoming edge of v
.
The behavior of this method is undefined if e
is not
an element of this vertex's graph.Edge findEdge(Vertex v)
v
,
or an undirected edge that connects this vertex to v
.
(Note that a directed incoming edge from v
to this vertex
will not be returned: only elements of the edge set returned by
getOutEdges()
will be returned by this method.)
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
.findEdgeSet(Vertex)
java.util.Set findEdgeSet(Vertex v)
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
.findEdge(Vertex)