All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class rpi.goldsd.graph.Edge

java.lang.Object
   |
   +----rpi.goldsd.graph.Edge

public class Edge
extends Object
implements Hashable
The Edge class is used to represent a single undirected edge between two vertices. An edge is associated with either zero or one GraphBase objects.

Version:
2.0, 4/19/98
Author:
David Goldschmidt
See Also:
GraphBase, DirectedEdge

Variable Index

 o associatedGraph
A reference to the graph that this undirected edge is associated with; or null if this undirected edge is not associated with a graph.
 o data
A reference to the Hashable object associated with this undirected edge.
 o endVertex
A reference to the second vertex endpoint associated with this undirected edge.
 o I
 o isWeighted
A flag used to indicate whether this edge is weighted.
 o keys
 o startVertex
A reference to the first vertex endpoint associated with this undirected edge.
 o status
Used by the static Algorithms class.
 o weight
The weight associated with this undirected edge.

Constructor Index

 o Edge()
The default constructor is not to be used, since an undirected edge must have a given start and end vertex.
 o Edge(Vertex, Vertex)
Constructs an undirected edge with the given pair of endpoint vertices.
 o Edge(Vertex, Vertex, double)
Constructs an undirected edge with the given pair of endpoint vertices, and the initial weight.
 o Edge(Vertex, Vertex, Hashable)
Constructs an undirected edge with the given pair of endpoint vertices, the initial Hashable object to be associated with this undirected edge.
 o Edge(Vertex, Vertex, Hashable, boolean, double)
Constructs an undirected edge with the given pair of endpoint vertices, the initial Hashable object to be associated with this undirected edge, and the initial weight.
 o Edge(Vertex, Vertex, Hashable, double)
Constructs an undirected edge with the given pair of endpoint vertices, the initial Hashable object to be associated with this undirected edge, and the initial weight.

Method Index

 o data()
Returns a reference to the Hashable object that is associated with this undirected edge.
 o endVertex()
Returns the second vertex endpoint of this undirected edge.
 o graph()
Returns a reference to the graph that contains this undirected edge, if any.
 o hash()
Returns the hash value of the Hashable data associated with this edge.
 o hash(int)
Returns the hash value of the Hashable data associated with this edge.
 o isEqualTo(Comparable)
Tests if two edges are "equal" based on their Hashable data objects.
 o isInGraph()
Tests if this undirected edge is associated with a graph.
 o isInGraph(GraphBase)
Tests if this undirected edge is associated with the given graph.
 o isLessThan(Comparable)
Tests if one edge is "less than" another based on their Hashable data objects.
 o isSelfLoop()
Tests if this undirected edge is a self-loop.
 o isWeighted()
Tests if this undirected edge is a weighted edge.
 o setData(Hashable)
Sets the Hashable object that is associated with this edge.
 o setInGraph(GraphBase)
Sets the associatedGraph reference to the given graph G.
 o setWeight(double)
Sets the weight of this edge.
 o startVertex()
Returns the first vertex endpoint of this undirected edge.
 o toString()
Returns a String representation of this undirected edge.
 o traverseFrom(Vertex)
Traverses this undirected edge from a given vertex, returning the destination vertex.
 o weight()
Returns the weight of this undirected edge, if any.

Variables

 o I
 protected static final IntSequence I
 o keys
 protected static final Enumeration keys
 o associatedGraph
 protected GraphBase associatedGraph
A reference to the graph that this undirected edge is associated with; or null if this undirected edge is not associated with a graph.

 o data
 protected Hashable data
A reference to the Hashable object associated with this undirected edge.

 o endVertex
 protected Vertex endVertex
A reference to the second vertex endpoint associated with this undirected edge.

 o isWeighted
 protected boolean isWeighted
A flag used to indicate whether this edge is weighted.

 o startVertex
 protected Vertex startVertex
A reference to the first vertex endpoint associated with this undirected edge.

 o weight
 protected double weight
The weight associated with this undirected edge.

 o status
 protected int status
Used by the static Algorithms class.

Constructors

 o Edge
 protected Edge(Vertex startVertex,
                Vertex endVertex,
                Hashable data,
                boolean isWeighted,
                double weight)
Constructs an undirected edge with the given pair of endpoint vertices, the initial Hashable object to be associated with this undirected edge, and the initial weight.

Parameters:
startVertex - the first endpoint vertex of this undirected edge.
endVertex - the second endpoint vertex of this undirected edge.
data - the Hashable object to be associated with this undirected edge.
isWeighted - indicates whether this edge is a directed edge.
weight - the initial weight of this undirected edge.
 o Edge
 public Edge(Vertex startVertex,
             Vertex endVertex,
             Hashable data,
             double weight)
Constructs an undirected edge with the given pair of endpoint vertices, the initial Hashable object to be associated with this undirected edge, and the initial weight.

Parameters:
startVertex - the first endpoint vertex of this undirected edge.
endVertex - the second endpoint vertex of this undirected edge.
data - the Hashable object to be associated with this undirected edge.
weight - the initial weight of this undirected edge.
 o Edge
 public Edge(Vertex startVertex,
             Vertex endVertex,
             double weight)
Constructs an undirected edge with the given pair of endpoint vertices, and the initial weight.

Parameters:
startVertex - the first endpoint vertex of this undirected edge.
endVertex - the second endpoint vertex of this undirected edge.
weight - the initial weight of this undirected edge.
 o Edge
 public Edge(Vertex startVertex,
             Vertex endVertex,
             Hashable data)
Constructs an undirected edge with the given pair of endpoint vertices, the initial Hashable object to be associated with this undirected edge.

Parameters:
startVertex - the first endpoint vertex of this undirected edge.
endVertex - the second endpoint vertex of this undirected edge.
data - the Hashable object to be associated with this undirected edge.
 o Edge
 public Edge(Vertex startVertex,
             Vertex endVertex)
Constructs an undirected edge with the given pair of endpoint vertices.

Parameters:
startVertex - the first endpoint vertex of this undirected edge.
endVertex - the second endpoint vertex of this undirected edge.
 o Edge
 protected Edge()
The default constructor is not to be used, since an undirected edge must have a given start and end vertex.

Methods

 o data
 public Hashable data()
Returns a reference to the Hashable object that is associated with this undirected edge.

Returns:
a reference to the Hashable object that is associated with this undirected edge.
 o endVertex
 public Vertex endVertex()
Returns the second vertex endpoint of this undirected edge. Note that the name endVertex does not imply a directed edge.

Returns:
the second vertex endpoint of this undirected edge.
 o graph
 public GraphBase graph()
Returns a reference to the graph that contains this undirected edge, if any.

Returns:
a reference to the graph that contains this undirected edge; or null if this undirected edge is not associated with a graph.
 o hash
 public int hash()
Returns the hash value of the Hashable data associated with this edge.

Returns:
the hash value of the Hashable data associated with this edge.
 o hash
 public int hash(int tableSize)
Returns the hash value of the Hashable data associated with this edge.

Parameters:
tableSize - the size of the table that will potentially hold this Edge object and others.
Returns:
the hash value of the Hashable data associated with this edge.
 o isEqualTo
 public boolean isEqualTo(Comparable C)
Tests if two edges are "equal" based on their Hashable data objects.

Parameters:
C - the right-hand side of the comparison.
Returns:
true if this edge is "equal" to the given edge C based on the Hashable data objects; false otherwise.
 o isInGraph
 public boolean isInGraph()
Tests if this undirected edge is associated with a graph.

Returns:
true if this undirected edge is associated with a graph; false otherwise.
 o isInGraph
 public boolean isInGraph(GraphBase G)
Tests if this undirected edge is associated with the given graph.

Parameters:
G - the graph to test.
Returns:
true if this undirected edge is associated with the given graph G; false otherwise.
 o isLessThan
 public boolean isLessThan(Comparable C)
Tests if one edge is "less than" another based on their Hashable data objects.

Parameters:
C - the right-hand side of the comparison.
Returns:
true if this edge is "less than" the given edge C based on the Hashable data objects; false otherwise.
 o isSelfLoop
 public boolean isSelfLoop()
Tests if this undirected edge is a self-loop.

Returns:
true if this undirected edge is a self-loop (i.e. both endpoint vertices are the same); false otherwise.
 o isWeighted
 public boolean isWeighted()
Tests if this undirected edge is a weighted edge.

Returns:
true if this undirected edge is a weighted edge; false otherwise.
 o startVertex
 public Vertex startVertex()
Returns the first vertex endpoint of this undirected edge. Note that the name startVertex does not imply a directed edge.

Returns:
the first vertex endpoint of this undirected edge.
 o toString
 public String toString()
Returns a String representation of this undirected edge. The toString() method is applied to the Hashable object that is associated with this edge.

Returns:
a String representation of this undirected edge.
Overrides:
toString in class Object
 o traverseFrom
 public Vertex traverseFrom(Vertex V)
Traverses this undirected edge from a given vertex, returning the destination vertex.

Parameters:
V - the vertex from which the traversal begins.
Returns:
the vertex this undirected edge is adjacent to from V; or null if V is not one of the endpoint vertices of this undirected edge.
 o weight
 public double weight()
Returns the weight of this undirected edge, if any.

Returns:
the weight of this undirected edge; or null if there is no weight associated with this undirected edge.
 o setData
 public Hashable setData(Hashable data)
Sets the Hashable object that is associated with this edge.

Parameters:
data - the new Hashable object.
Returns:
the old Hashable object associated with this edge.
 o setInGraph
 protected void setInGraph(GraphBase G)
Sets the associatedGraph reference to the given graph G.

Parameters:
G - the graph that this undirected edge is to be associated with.
 o setWeight
 public double setWeight(double weight)
Sets the weight of this edge.

Parameters:
weight - the weight to be associated with this edge.
Returns:
the old weight of this edge; or null if there was no weight associated with this edge.

All Packages  Class Hierarchy  This Package  Previous  Next  Index