net.datastructures - version 5.0

net.datastructures
Class AdjacencyListGraph.MyVertex<V>

java.lang.Object
  extended by net.datastructures.HashTableMap<Object,Object>
      extended by net.datastructures.AdjacencyListGraph.MyPosition<V>
          extended by net.datastructures.AdjacencyListGraph.MyVertex<V>
All Implemented Interfaces:
DecorablePosition<V>, Map<Object,Object>, Position<V>, Vertex<V>
Enclosing class:
AdjacencyListGraph<V,E>

protected class AdjacencyListGraph.MyVertex<V>
extends AdjacencyListGraph.MyPosition<V>
implements Vertex<V>

Implementation of a vertex for an undirected adjacency list graph. Each vertex stores its incidence container and position in the vertex container of the graph.


Nested Class Summary
 
Nested classes/interfaces inherited from class net.datastructures.HashTableMap
HashTableMap.HashEntry<K,V>
 
Field Summary
protected  PositionList<Edge<E>> incEdges
          Incidence container of the vertex.
protected  Position<Vertex<V>> loc
          Position of the vertex in the vertex container of the graph.
 
Fields inherited from class net.datastructures.AdjacencyListGraph.MyPosition
elem
 
Fields inherited from class net.datastructures.HashTableMap
AVAILABLE, bucket, capacity, n, prime, scale, shift
 
Method Summary
 int degree()
          Return the degree of a given vertex
 Iterable<Edge<E>> incidentEdges()
          Returns the incident edges on this vertex.
 Position<Edge<E>> insertIncidence(Edge<E> e)
          Inserts an edge into the incidence container of this vertex.
 Position<Vertex<V>> location()
          Returns the position of this vertex in the vertex container of the graph.
 void removeIncidence(Position<Edge<E>> p)
          Removes an edge from the incidence container of this vertex.
 void setLocation(Position<Vertex<V>> p)
          Sets the position of this vertex in the vertex container of the graph.
 String toString()
          Returns a string representation of the element stored at this vertex.
 
Methods inherited from class net.datastructures.AdjacencyListGraph.MyPosition
element, setElement
 
Methods inherited from class net.datastructures.HashTableMap
checkKey, entrySet, findEntry, get, hashValue, isEmpty, keySet, put, rehash, remove, size, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.datastructures.Position
element
 
Methods inherited from interface net.datastructures.Map
entrySet, get, isEmpty, keySet, put, remove, size, values
 

Field Detail

incEdges

protected PositionList<Edge<E>> incEdges
Incidence container of the vertex.


loc

protected Position<Vertex<V>> loc
Position of the vertex in the vertex container of the graph.

Method Detail

degree

public int degree()
Return the degree of a given vertex


incidentEdges

public Iterable<Edge<E>> incidentEdges()
Returns the incident edges on this vertex.


insertIncidence

public Position<Edge<E>> insertIncidence(Edge<E> e)
Inserts an edge into the incidence container of this vertex.


removeIncidence

public void removeIncidence(Position<Edge<E>> p)
Removes an edge from the incidence container of this vertex.


location

public Position<Vertex<V>> location()
Returns the position of this vertex in the vertex container of the graph.


setLocation

public void setLocation(Position<Vertex<V>> p)
Sets the position of this vertex in the vertex container of the graph.


toString

public String toString()
Returns a string representation of the element stored at this vertex.

Overrides:
toString in class Object

net.datastructures - version 5.0