lab_graphs
Gangnam-Style Graphs
Public Member Functions | Public Attributes | List of all members
Edge Class Reference

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

#include <edge.h>

Public Member Functions

 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.
 
bool operator< (const Edge &other) const
 Compares two Edges. More...
 

Public Attributes

Vertex source
 
Vertex dest
 
int weight
 
string label
 

Detailed Description

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

Author
Sean Massung
Date
Spring 2012

Constructor & Destructor Documentation

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::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

Member Function Documentation

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

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