Graph
Class Edge

java.lang.Object
  extended by Graph.Edge

public abstract class Edge
extends java.lang.Object

This abstract class specifies a generic edge. Each edge has an id, a source and a target. It also has a weight function, which is left unspecified, to be determined by later implementations.


Field Summary
protected  int id
          The unique id of the edge
protected  int source
          The source node of the edge
protected  int target
          The target node of the edge
 
Constructor Summary
Edge(Edge e)
          Copy Constructor.
Edge(int source, int target)
          Constructor with no id.
Edge(int source, int target, int id)
          Constructor with id.
 
Method Summary
 boolean equals(java.lang.Object o)
          Returns true if two edge objects are equal.
 int id()
          Return the edge's id
 int source()
          Returns the source node of the edge
 int target()
          Returns the target node of the edge
 java.lang.String toString()
          String representation
abstract  double weight()
          Returns the weight of the edge
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected int id
The unique id of the edge


source

protected int source
The source node of the edge


target

protected int target
The target node of the edge

Constructor Detail

Edge

public Edge(int source,
            int target)
Constructor with no id. The id is guaranteed to be unique if only this constructor is used.


Edge

public Edge(int source,
            int target,
            int id)
Constructor with id. The id of edges is not necessarily unique. This method is useful for checking edge equality.


Edge

public Edge(Edge e)
Copy Constructor.

Method Detail

id

public int id()
Return the edge's id


source

public int source()
Returns the source node of the edge


target

public int target()
Returns the target node of the edge


equals

public boolean equals(java.lang.Object o)
Returns true if two edge objects are equal. Edges are uniquely identified by the three fields id,source and target.

Overrides:
equals in class java.lang.Object

weight

public abstract double weight()
Returns the weight of the edge


toString

public java.lang.String toString()
String representation

Overrides:
toString in class java.lang.Object