|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A specific type of 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
Nested Class Summary |
Nested classes inherited from class edu.uci.ics.jung.utils.UserDataContainer |
UserDataContainer.CopyAction |
Method Summary | |
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. |
Methods inherited from interface edu.uci.ics.jung.graph.ArchetypeVertex |
copy, degree, getEqualVertex, getEquivalentVertex, getGraph, getIncidentEdges, getNeighbors, isIncident, isNeighborOf, numNeighbors |
Methods inherited from interface edu.uci.ics.jung.utils.UserDataContainer |
addUserDatum, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum |
Method Detail |
public 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)
public 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)
public 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()
public 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()
public int inDegree()
getInEdges()
,
ArchetypeVertex.degree()
public int outDegree()
getOutEdges()
,
ArchetypeVertex.degree()
public int numPredecessors()
getPredecessors()
,
ArchetypeVertex.numNeighbors()
public int numSuccessors()
getSuccessors()
,
ArchetypeVertex.numNeighbors()
public 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.
ArchetypeVertex.isNeighborOf(ArchetypeVertex)
,
getSuccessors()
public 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.
ArchetypeVertex.isNeighborOf(ArchetypeVertex)
,
getPredecessors()
public 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.
DirectedEdge.getSource()
,
ArchetypeVertex.isIncident(ArchetypeEdge)
public 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.
DirectedEdge.getDest()
,
ArchetypeVertex.isIncident(ArchetypeEdge)
public 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 parallel edges connecting this
vertex to v
), any edge connecting this vertex to
v
may be returned.
If v
is not connected to this vertex, returns
null
.
public java.util.Set findEdgeSet(Vertex v)
v
. If v
is not connected to this vertex, returns an empty Set
.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |