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
-
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.
-
data
- A reference to the Hashable object associated with this
undirected edge.
-
endVertex
- A reference to the second vertex endpoint associated with this
undirected edge.
-
I
-
-
isWeighted
- A flag used to indicate whether this edge is weighted.
-
keys
-
-
startVertex
- A reference to the first vertex endpoint associated with this
undirected edge.
-
status
- Used by the static Algorithms class.
-
weight
- The weight associated with this undirected edge.
-
Edge()
- The default constructor is not to be used, since an undirected edge
must have a given start and end vertex.
-
Edge(Vertex, Vertex)
- Constructs an undirected edge with the given pair of endpoint
vertices.
-
Edge(Vertex, Vertex, double)
- Constructs an undirected edge with the given pair of endpoint
vertices, and the initial weight.
-
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.
-
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.
-
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.
-
data()
- Returns a reference to the Hashable object that is
associated with this undirected edge.
-
endVertex()
- Returns the second vertex endpoint of this undirected edge.
-
graph()
- Returns a reference to the graph that contains this undirected
edge, if any.
-
hash()
- Returns the hash value of the Hashable data associated with
this edge.
-
hash(int)
- Returns the hash value of the Hashable data associated with
this edge.
-
isEqualTo(Comparable)
- Tests if two edges are "equal" based on their Hashable data
objects.
-
isInGraph()
- Tests if this undirected edge is associated with a graph.
-
isInGraph(GraphBase)
- Tests if this undirected edge is associated with the given graph.
-
isLessThan(Comparable)
- Tests if one edge is "less than" another based on their Hashable
data objects.
-
isSelfLoop()
- Tests if this undirected edge is a self-loop.
-
isWeighted()
- Tests if this undirected edge is a weighted edge.
-
setData(Hashable)
- Sets the Hashable object that is associated with this edge.
-
setInGraph(GraphBase)
- Sets the associatedGraph reference to the given graph G.
-
setWeight(double)
- Sets the weight of this edge.
-
startVertex()
- Returns the first vertex endpoint of this undirected edge.
-
toString()
- Returns a String representation of this undirected edge.
-
traverseFrom(Vertex)
- Traverses this undirected edge from a given vertex, returning
the destination vertex.
-
weight()
- Returns the weight of this undirected edge, if any.
I
protected static final IntSequence I
keys
protected static final Enumeration keys
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.
data
protected Hashable data
- A reference to the Hashable object associated with this
undirected edge.
endVertex
protected Vertex endVertex
- A reference to the second vertex endpoint associated with this
undirected edge.
isWeighted
protected boolean isWeighted
- A flag used to indicate whether this edge is weighted.
startVertex
protected Vertex startVertex
- A reference to the first vertex endpoint associated with this
undirected edge.
weight
protected double weight
- The weight associated with this undirected edge.
status
protected int status
- Used by the static Algorithms class.
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.
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.
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.
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.
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.
Edge
protected Edge()
- The default constructor is not to be used, since an undirected edge
must have a given start and end vertex.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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