GraphLab Project

graphlab.library
Class BaseEdge<VertexType extends BaseVertex>

java.lang.Object
  extended by graphlab.library.BaseEdge<VertexType>
All Implemented Interfaces:
java.lang.Comparable<BaseEdge<VertexType>>
Direct Known Subclasses:
EdgeModel, TestNewEdge

public class BaseEdge<VertexType extends BaseVertex>
extends java.lang.Object
implements java.lang.Comparable<BaseEdge<VertexType>>

The base class for all edges. By default each vertex has two integer properties, color and weight.

Author:
Omid Aladini

Field Summary
protected  BaseEdgeProperties prop
           
 VertexType source
           
 VertexType target
           
 
Constructor Summary
BaseEdge(VertexType source, VertexType target)
           
BaseEdge(VertexType source, VertexType target, BaseEdgeProperties prop)
           
 
Method Summary
 int compareTo(BaseEdge<VertexType> o)
          Compares two edges according to their wrights.
 int getColor()
          Returns the color of the edge.
 BaseEdge getCopy(VertexType v1, VertexType v2)
           
 boolean getMark()
          Returns the mark of the edge.
 BaseEdgeProperties getProp()
          Returns property object for this edge.
 int getWeight()
          Returns the weight of the edge.
 void setColor(int color)
          Sets the color of the edge.
 void setMark(boolean m)
          Sets the mark of the edge.
 void setProp(BaseEdgeProperties prop)
          Sets properties object for this edge; Overwrites the existing.
 void setWeight(int weight)
          Sets the weight of the edge.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

prop

protected BaseEdgeProperties prop

source

public final VertexType extends BaseVertex source

target

public final VertexType extends BaseVertex target
Constructor Detail

BaseEdge

public BaseEdge(VertexType source,
                VertexType target)

BaseEdge

public BaseEdge(VertexType source,
                VertexType target,
                BaseEdgeProperties prop)
Method Detail

getCopy

public BaseEdge getCopy(VertexType v1,
                        VertexType v2)

getColor

public int getColor()
Returns the color of the edge.

Returns:
The color associated with the edge.

setColor

public void setColor(int color)
Sets the color of the edge.

Parameters:
color - Sets col as the color of the edge.

getWeight

public int getWeight()
Returns the weight of the edge.

Returns:
The weight associated with the edge.

setWeight

public void setWeight(int weight)
Sets the weight of the edge.

Parameters:
weight - Sets w as the color of the edge.

getMark

public boolean getMark()
Returns the mark of the edge.

Returns:
The mark associated with the edge.

setMark

public void setMark(boolean m)
Sets the mark of the edge.

Parameters:
m - Sets m as the mark of the edge.

setProp

public void setProp(BaseEdgeProperties prop)
Sets properties object for this edge; Overwrites the existing.

Parameters:
prop - The property object to set.

getProp

public BaseEdgeProperties getProp()
Returns property object for this edge.

Returns:
Returns property object for this edge.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(BaseEdge<VertexType> o)
Compares two edges according to their wrights.

Specified by:
compareTo in interface java.lang.Comparable<BaseEdge<VertexType extends BaseVertex>>
Parameters:
o - Edge to compare.
Returns:
0 if two objects are equal, -1 if this object is less than and 1 if this object is greater than the supplied object.

GraphLab Project