edu.uci.ics.jung.graph
Interface Vertex

All Superinterfaces:
ArchetypeVertex, UserDataContainer
All Known Subinterfaces:
GraphCollapser.CollapsedVertex
All Known Implementing Classes:
AbstractSparseVertex, BipartiteGraphCollapser.CollapsedBipartiteVertex, GraphCollapser.CollapsedSparseVertex

public interface Vertex
extends ArchetypeVertex

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 true
 
For 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
 

Author:
Joshua O'Madadhain, Danyel Fisher, Scott White
See Also:
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

getPredecessors

public java.util.Set getPredecessors()
Returns the set of predecessors of this vertex. A vertex 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.

Returns:
all predecessors of this vertex
See Also:
ArchetypeVertex.getNeighbors(), isPredecessorOf(Vertex)

getSuccessors

public java.util.Set getSuccessors()
Returns the set of successors of this vertex. A vertex 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.

Returns:
all successors of this vertex
See Also:
ArchetypeVertex.getNeighbors(), isSuccessorOf(Vertex)

getInEdges

public java.util.Set getInEdges()
Returns the set of incoming edges of this vertex. An edge 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.

Returns:
all edges whose destination is this vertex
See Also:
ArchetypeVertex.getIncidentEdges()

getOutEdges

public java.util.Set getOutEdges()
Returns the set of outgoing edges of this vertex. An edge 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.

Returns:
all edges whose source is this vertex
See Also:
ArchetypeVertex.getIncidentEdges()

inDegree

public int inDegree()
Returns the number of incoming edges that are incident to this vertex.

Returns:
the number of incoming edges of this vertex
See Also:
getInEdges(), ArchetypeVertex.degree()

outDegree

public int outDegree()
Returns the number of outgoing edges that are incident to this vertex.

Returns:
the number of outgoing edges of this vertex
See Also:
getOutEdges(), ArchetypeVertex.degree()

numPredecessors

public int numPredecessors()
Returns the number of predecessors of this vertex.

Since:
1.1.1
See Also:
getPredecessors(), ArchetypeVertex.numNeighbors()

numSuccessors

public int numSuccessors()
Returns the number of successors of this vertex.

Since:
1.1.1
See Also:
getSuccessors(), ArchetypeVertex.numNeighbors()

isSuccessorOf

public boolean isSuccessorOf(Vertex v)
Returns 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.

See Also:
ArchetypeVertex.isNeighborOf(ArchetypeVertex), getSuccessors()

isPredecessorOf

public boolean isPredecessorOf(Vertex v)
Returns 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.

See Also:
ArchetypeVertex.isNeighborOf(ArchetypeVertex), getPredecessors()

isSource

public boolean isSource(Edge e)
Returns 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.

See Also:
DirectedEdge.getSource(), ArchetypeVertex.isIncident(ArchetypeEdge)

isDest

public boolean isDest(Edge e)
Returns 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.

See Also:
DirectedEdge.getDest(), ArchetypeVertex.isIncident(ArchetypeEdge)

findEdge

public Edge findEdge(Vertex v)
Returns a directed outgoing edge from this vertex to 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.


findEdgeSet

public java.util.Set findEdgeSet(Vertex v)
Returns the set of all edges that connect this vertex with the specified vertex v. If v is not connected to this vertex, returns an empty Set.