Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.uci.ics.jung.graph
Interface ArchetypeVertex

All Superinterfaces:
  Cloneable, Element, UserDataContainer

All Known Subinterfaces:
  GraphCollapser.CollapsedVertex, Hypervertex, Vertex

All Known Implementing Classes:
  AbstractArchetypeVertex, AbstractHypervertex, AbstractSparseVertex, BipartiteGraphCollapser.CollapsedBipartiteVertex, GraphCollapser.CollapsedSparseVertex, HypervertexBPG

public interface ArchetypeVertex
extends Element

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.

Author:
  Danyel Fisher, Joshua O'Madadhain, Scott White
See Also:
  `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.
`ArchetypeEdge` | `findEdge(ArchetypeVertex v)` Returns an edge that connects this vertex to `v`.
`Set` | `findEdgeSet(ArchetypeVertex v)` Returns the set of all edges that connect this vertex with the specified vertex `v`.
`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).
`Set` | `getIncidentEdges()` Returns the set of edges which are incident to this vertex.
`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.graph.Element
`getGraph, getIncidentElements`

Methods inherited from interface edu.uci.ics.jung.utils.UserDataContainer
`addUserDatum, clone, containsUserDatumKey, getUserDatum, getUserDatumCopyAction, getUserDatumKeyIterator, importUserData, removeUserDatum, setUserDatum`

Method Detail

### getNeighbors

    public Set getNeighbors()

  Returns the set of vertices which are connected to this vertex via edges; each of these vertices should implement `ArchetypeVertex`. If this vertex is connected to itself with a self-loop, then this vertex will be included in its own neighbor set.

### getIncidentEdges

    public Set getIncidentEdges()

  Returns the set of edges which are incident to this vertex. Each of these edges should implement `ArchetypeEdge`.

### degree

    public int degree()

  Returns the number of edges incident to this vertex. Special cases of interest:
  - If there is only one edge that connects this vertex to each of its neighbors (and vice versa), then the value returned will also be equal to the number of neighbors that this vertex has.
  - If the graph is directed, then the value returned will be the sum of this vertex's indegree (the number of edges whose destination is this vertex) and its outdegree (the number of edges whose source is this vertex).

  Returns:
    int the degree of this node
  See Also:
    `numNeighbors()`

### numNeighbors

    public int numNeighbors()

  Returns the number of neighbors that this vertex has. If the graph is directed, the value returned will be the sum of the number of predecessors and the number of successors that this vertex has.

  Since:
    1.1.1
  See Also:
    `degree()`

### getEqualVertex

    public ArchetypeVertex getEqualVertex(ArchetypeGraph g)

  Returns the vertex in graph `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.

  See Also:
    `copy(ArchetypeGraph)`, `ArchetypeEdge.getEqualEdge(ArchetypeGraph)`

### getEquivalentVertex

    public ArchetypeVertex getEquivalentVertex(ArchetypeGraph g)

  Deprecated. As of version 1.4, renamed to getEqualVertex(g).

### isNeighborOf

    public 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. The behavior of this method is undefined if `v` is not an element of this vertex's graph.

### isIncident

    public boolean isIncident(ArchetypeEdge e)

  Returns `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.

### copy

    public ArchetypeVertex copy(ArchetypeGraph g)

  Creates a copy of this vertex in graph `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`.

  Parameters:
    `g` - the graph in which the copied vertex will be placed
  Returns:
    the vertex created

### findEdge

    public ArchetypeEdge findEdge(ArchetypeVertex v)

  Returns an edge that connects this vertex to `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`.

  See Also:
    `findEdgeSet(ArchetypeVertex)`

### findEdgeSet

    public Set findEdgeSet(ArchetypeVertex v)

  Returns the set of all edges that connect this vertex with the specified vertex `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`.

  See Also:
    `findEdge(ArchetypeVertex)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD