lab_ml
Lazy Machine Learning
Edge Class Reference

Represents an edge in a graph; used by the Graph class. More...

#include <edge.h>

Collaboration diagram for Edge:
[legend]

Public Member Functions

 Edge (Vertex u, Vertex v)
 Parameter constructor for unweighted graphs. More...
 
 Edge (Vertex u, Vertex v, string lbl)
 Parameter constructor for unweighted graphs. More...
 
 Edge (Vertex u, Vertex v, int w, string lbl)
 Parameter constructor for weighted graphs. More...
 
 Edge ()
 Default constructor. More...
 
bool operator< (const Edge &other) const
 Compares two Edges. More...
 
string getLabel () const
 Gets edge label. More...
 
int getWeight () const
 Gets edge weight. More...
 
bool operator== (Edge &other) const
 Compares two edges' source and dest. More...
 

Public Attributes

Vertex source
 The source of the edge. More...
 
Vertex dest
 The destination of the edge. More...
 

Private Attributes

string label
 The edge label. More...
 
int weight
 The edge weight (if in a weighed graph) More...
 

Detailed Description

Represents an edge in a graph; used by the Graph class.

Author
Sean Massung
Date
Spring 2012

Constructor & Destructor Documentation

◆ Edge() [1/4]

Edge::Edge ( Vertex  u,
Vertex  v 
)
inline

Parameter constructor for unweighted graphs.

Parameters
u- one vertex the edge is connected to
v- the other vertex it is connected to

◆ Edge() [2/4]

Edge::Edge ( Vertex  u,
Vertex  v,
string  lbl 
)
inline

Parameter constructor for unweighted graphs.

Parameters
u- one vertex the edge is connected to
v- the other vertex it is connected to
lbl- the edge label

◆ Edge() [3/4]

Edge::Edge ( Vertex  u,
Vertex  v,
int  w,
string  lbl 
)
inline

Parameter constructor for weighted graphs.

Parameters
u- one vertex the edge is connected to
v- the other vertex it is connected to
w- the weight of the edge
lbl- the edge label

◆ Edge() [4/4]

Edge::Edge ( )
inline

Default constructor.

Member Function Documentation

◆ getLabel()

string Edge::getLabel ( ) const
inline

Gets edge label.

◆ getWeight()

int Edge::getWeight ( ) const
inline

Gets edge weight.

◆ operator<()

bool Edge::operator< ( const Edge other) const
inline

Compares two Edges.

operator< is defined so Edges can be sorted with std::sort.

Parameters
other- the edge to compare with
Returns
whether the current edge is less than the parameter

◆ operator==()

bool Edge::operator== ( Edge other) const
inline

Compares two edges' source and dest.

Parameters
other- the edge to compare with

Member Data Documentation

◆ dest

Vertex Edge::dest

The destination of the edge.

◆ label

string Edge::label
private

The edge label.

◆ source

Vertex Edge::source

The source of the edge.

◆ weight

int Edge::weight
private

The edge weight (if in a weighed graph)


The documentation for this class was generated from the following file: