|
|
/*************************************************************************** edge.h ------------------- begin : Wed Sep 8 1999 copyright : (C) 1999 by Jan Meinke email : meinke@bigfoot.com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef EDGE_H #define EDGE_H #include <iostream> class Vertex; /**This class represents an edge in a graph. *@author Jan Meinke */ class Edge { public: Edge(Vertex& a, Vertex& b); Edge(Vertex& a, Vertex& b, int uin, int cin); ~Edge(); //========================================================================== // Public Accessor //========================================================================== /** Return the origin of the edge */ Vertex& getOrigin(); /** Return the target of the edge */ Vertex& getTarget(); /** Return the current rest capacity */ int getCapacity(); /** Return the maximum capacity of the edge */ int getMaxCapacity(); /** Return the current flow through the edge */ int getFlow(); //========================================================================== // Public Modifiers //========================================================================== /** addFlow(int flow) adds the given amount of flow to the edge. An exception is * thrown if flow exceeds the remaining capacity. */ void addFlow(int flow); /** setCapacity(...) changes the capacity of the Edge. If the new capacity * is negative the capacity of the edge is set to zero. */ void setCapacity(int capacity); //ostream& operator<<(ostream& os, Edge& e); public: // Public attributes class OutofRangeException{}; private: // Private functions // private attributes /** Capacity of the edge */ int u; /** Flow along the edge */ int f; /** Cost of the edge */ int c; /** The tail of a directed edge. */ Vertex* origin; /** The head of a directed edge */ Vertex* target; }; #endif
Generated by: meinke@orion on Mon May 8 18:18:46 2000, using kdoc 2.0a35. |