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.impl
Class AbstractSparseVertex

    java.lang.Object
      edu.uci.ics.jung.utils.UserDataDelegate
          edu.uci.ics.jung.graph.impl.AbstractElement
              edu.uci.ics.jung.graph.impl.AbstractArchetypeVertex
                  edu.uci.ics.jung.graph.impl.AbstractSparseVertex

All Implemented Interfaces:
  ArchetypeVertex, Cloneable, Element, UserDataContainer, Vertex

Direct Known Subclasses:
  LeanSparseVertex, SimpleDirectedSparseVertex, SimpleSparseVertex, SimpleUndirectedSparseVertex

public abstract class AbstractSparseVertex
extends AbstractArchetypeVertex
implements Vertex, Cloneable

This class provides a skeletal implementation of the `Vertex` interface to minimize the effort required to implement this interface. It is appropriate for sparse graphs (those in which each vertex is connected to only a few other vertices); for dense graphs (those in which each vertex is connected to most other vertices), another implementation might be more appropriate.

This class extends `UserData`, which provides storage and retrieval mechanisms for user-defined data for each edge instance. This allows users to attach data to edges without having to extend this class.

Author:
  Scott White, Danyel Fisher, Joshua O'Madadhain
See Also:
  `AbstractSparseGraph`, `AbstractSparseEdge`

Nested Class Summary

Nested classes inherited from class edu.uci.ics.jung.utils.UserDataContainer
`UserDataContainer.CopyAction`

Field Summary

Fields inherited from class edu.uci.ics.jung.graph.impl.AbstractElement
`id, m_Graph`

Fields inherited from class edu.uci.ics.jung.utils.UserDataDelegate
`factory, udc_delegate`

Constructor Summary
`protected` | `AbstractSparseVertex()` Creates a new instance of a vertex for inclusion in a sparse graph.

Method Summary
`protected abstract void` | `addNeighbor_internal(Edge e, Vertex v)` Adds the specified edge `e` and vertex `v` to the internal data structures of this vertex.
`ArchetypeVertex` | `copy(ArchetypeGraph newGraph)` Creates a copy of this vertex in graph `g`.
`ArchetypeEdge` | `findEdge(ArchetypeVertex v)` Returns an edge that connects this vertex to `v`.
`Edge` | `findEdge(Vertex v)` Returns the edge that connects this vertex to the specified vertex `v`.
`Set` | `findEdgeSet(ArchetypeVertex v)` Returns the set of all edges that connect this vertex with the specified vertex `v`.
`Set` | `findEdgeSet(Vertex v)` Returns the set of all edges that connect this vertex with the specified vertex `v`.
`protected abstract void` | `removeNeighbor_internal(Edge e, Vertex v)` Removes the specified edge `e` and vertex `v` from the internal data structures of this vertex.
`String` | `toString()` Returns a human-readable representation of this vertex.

Methods inherited from class edu.uci.ics.jung.graph.impl.AbstractArchetypeVertex
`degree, equals, getEdges_internal, getEqualVertex, getEquivalentVertex, getIncidentEdges, getIncidentElements, getNeighbors_internal, getNeighbors, isIncident, isNeighborOf, numNeighbors`

Methods inherited from class edu.uci.ics.jung.graph.impl.AbstractElement
`addGraph_internal, getGraph, hashCode, initialize, removeGraph_internal`

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

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface edu.uci.ics.jung.graph.Vertex
`getInEdges, getOutEdges, getPredecessors, getSuccessors, inDegree, isDest, isPredecessorOf, isSource, isSuccessorOf, numPredecessors, numSuccessors, outDegree`

Methods inherited from interface edu.uci.ics.jung.graph.ArchetypeVertex
`degree, getEqualVertex, getEquivalentVertex, getIncidentEdges, getNeighbors, isIncident, isNeighborOf, numNeighbors`

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`

Constructor Detail

### AbstractSparseVertex

    protected AbstractSparseVertex()

  Creates a new instance of a vertex for inclusion in a sparse graph. Sets up the data necessary for definition of vertex equivalence, and initializes the internal data structures.

See Also:
  `AbstractElement.initialize()`

Method Detail

### findEdge

    public Edge findEdge(Vertex v)

  Returns the edge that connects this vertex to the specified vertex `v`. This is a simple implementation which checks the opposite vertex of each outgoing edge of this vertex; this solution is general, but not efficient.

  Specified by:
    `findEdge` in interface `Vertex`
  See Also:
    `Vertex.findEdge(Vertex)`

### findEdge

    public ArchetypeEdge findEdge(ArchetypeVertex v)

  Description copied from interface: `ArchetypeVertex`
  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`.

  Specified by:
    `findEdge` in interface `ArchetypeVertex`
  Overrides:
    `findEdge` in class `AbstractArchetypeVertex`
  See Also:
    `ArchetypeVertex.findEdge(edu.uci.ics.jung.graph.ArchetypeVertex)`

### findEdgeSet

    public Set findEdgeSet(Vertex v)

  Description copied from interface: `Vertex`
  Returns the set of all edges that connect this vertex with the specified vertex `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`.

  Specified by:
    `findEdgeSet` in interface `Vertex`
  See Also:
    `Vertex.findEdgeSet(Vertex)`

### findEdgeSet

    public Set findEdgeSet(ArchetypeVertex v)

  Description copied from interface: `ArchetypeVertex`
  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`.

  Specified by:
    `findEdgeSet` in interface `ArchetypeVertex`
  Overrides:
    `findEdgeSet` in class `AbstractArchetypeVertex`
  See Also:
    `ArchetypeVertex.findEdgeSet(ArchetypeVertex)`

### copy

    public ArchetypeVertex copy(ArchetypeGraph newGraph)

  Description copied from interface: `ArchetypeVertex`
  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`.

  Specified by:
    `copy` in interface `ArchetypeVertex`
  Overrides:
    `copy` in class `AbstractArchetypeVertex`
  See Also:
    `ArchetypeVertex.copy(ArchetypeGraph)`

### addNeighbor_internal

    protected abstract void addNeighbor_internal(Edge e,
                                                 Vertex v)

  Adds the specified edge `e` and vertex `v` to the internal data structures of this vertex.

  Parameters:
    `e` - the new incident edge of this vertex
    `v` - the new neighbor of this vertex

### removeNeighbor_internal

    protected abstract void removeNeighbor_internal(Edge e,
                                                    Vertex v)

  Removes the specified edge `e` and vertex `v` from the internal data structures of this vertex.

  Parameters:
    `e` - the incident edge of this vertex which is being removed
    `v` - the neighbor of this vertex which is being removed

### toString

    public String toString()

  Returns a human-readable representation of this vertex.

  See Also:
    `Object.toString()`

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