All Packages Class Hierarchy This Package Previous Next Index
Class structure.Edge
java.lang.Object

+structure.Edge
 public class Edge
 extends Object
A class implementing common edge type among graphs. This class
supports both directed and undirected edges. Edge may also have
visited flags set and cleared.
 See Also:
 Graph

Edge(Object, Object, Object, boolean)
 Construct a (possibly directed) edge between two labeled
vertices.

equals(Object)
 Test for equality of edges.

hashCode()
 Returns hashcode associated with edge.

here()
 Returns the first vertex (or source if directed).

isVisited()
 Check to see if edge has been visited.

label()
 Get label associated with edge.

reset()
 Clear the visited flag associated with edge.

setLabel(Object)
 Sets the label associated with the edge.

there()
 Returns the second vertex (or source if undirected).

toString()
 Construct a string representation of edge.

visit()
 Test and set visited flag on vertex.
Edge
public Edge(Object vtx1,
Object vtx2,
Object label,
boolean directed)
 Construct a (possibly directed) edge between two labeled
vertices. When edge is directed, vtx1 specifies source.
When undirected, order of vertices is unimportant. Label
on edge is any type, and may be null.
Edge is initially unvisited.
 Postcondition:
 edge associates vtx1 and vtx2. labeled with label.
directed if "directed" set true
 Parameters:
 vtx1  The label of a vertex (source if directed).
 vtx2  The label of another vertex (destination if directed).
 label  The label associated with the edge.
 directed  True iff this edge is directed.
here
public Object here()
 Returns the first vertex (or source if directed).
 Postcondition:
 returns first node in edge
 Returns:
 A vertex; if directed, the source.
there
public Object there()
 Returns the second vertex (or source if undirected).
 Postcondition:
 returns second node in edge
 Returns:
 A vertex; if directed, the destination.
setLabel
public void setLabel(Object label)
 Sets the label associated with the edge. May be null.
 Postcondition:
 sets label of this edge to label
 Parameters:
 label  Any object to label edge, or null.
label
public Object label()
 Get label associated with edge.
 Postcondition:
 returns label associated with this edge
 Returns:
 The label found on the edge.
visit
public boolean visit()
 Test and set visited flag on vertex.
 Postcondition:
 visits node, returns whether previously visited
 Returns:
 True iff node was visited previously.
isVisited
public boolean isVisited()
 Check to see if edge has been visited.
 Postcondition:
 returns true iff node has been visited
 Returns:
 True iff the edge has been visited.
reset
public void reset()
 Clear the visited flag associated with edge.
 Postcondition:
 resets edge's visited flag to initial state
hashCode
public int hashCode()
 Returns hashcode associated with edge.
 Postcondition:
 returns suitable hashcode.
 Returns:
 An integer code suitable for hashing.
 Overrides:
 hashCode in class Object
equals
public boolean equals(Object o)
 Test for equality of edges. Undirected edges are equal if
they connect the same vertices. Directed edges must have same
direction.
 Postcondition:
 returns true iff edges connect same vertices
 Parameters:
 o  The other edge.
 Returns:
 True iff this edge is equal to other edge.
 Overrides:
 equals in class Object
toString
public String toString()
 Construct a string representation of edge.
 Postcondition:
 returns string representation of edge
 Returns:
 String representing edge.
 Overrides:
 toString in class Object
All Packages Class Hierarchy This Package Previous Next Index