Open
Graph Drawing
Framework

 v.2012.05
 

ShortestPathModule.h
Go to the documentation of this file.
00001 /*
00002  * $Revision: 2299 $
00003  * 
00004  * last checkin:
00005  *   $Author: gutwenger $ 
00006  *   $Date: 2012-05-07 15:57:08 +0200 (Mon, 07 May 2012) $ 
00007  ***************************************************************/
00008  
00045 #ifdef _MSC_VER
00046 #pragma once
00047 #endif
00048 
00049 #ifndef OGDF_SHORTEST_PATH_MODULE_H
00050 #define OGDF_SHORTEST_PATH_MODULE_H
00051 
00052 
00053 #include <ogdf/basic/Graph.h>
00054 
00055 
00056 namespace ogdf {
00057 
00058 
00059 class OGDF_EXPORT ShortestPathModule
00060 {
00061 public:
00062     ShortestPathModule() { }
00063     virtual ~ShortestPathModule() {}
00064 
00065     // computes shortest paths
00066     // Precond.: 
00067     // returns true iff a feasible min-cost flow exists
00068     virtual bool call(
00069         const Graph &G,                   // directed graph
00070         const node s,                     // source node
00071         const EdgeArray<int> &length,     // length of an edge
00072         NodeArray<int> &d,                // contains shortest path distances after call
00073         NodeArray<edge> &pi
00074     ) = 0;
00075 
00076 
00077 
00078 protected:
00079     //
00080     // static functions
00081     //
00082 
00083     // generates a shortest path problem instance with n nodes and m+n edges
00084     /*
00085     static void generateProblem(
00086         Graph &G,
00087         int n,
00088         int m,
00089         EdgeArray<int> &lowerBound,
00090         EdgeArray<int> &upperBound,
00091         EdgeArray<int> &cost,
00092         NodeArray<int> &supply);
00093 
00094 
00095     // checks if a given min-cost flow problem instance satisfies
00096     // the preconditions
00097     //    
00098     //    lowerBound[e] <= upperBound[e] for all edges e
00099     //    cost[e] >= 0 for all edges e
00100     //    sum over all supply[v] = 0
00101     static bool checkProblem(
00102         const Graph &G,
00103         const EdgeArray<int> &lowerBound,
00104         const EdgeArray<int> &upperBound,
00105         const EdgeArray<int> &cost,
00106         const NodeArray<int> &supply);
00107 
00108 
00109 
00110     // checks if a computed flow is a feasible solution to the given problem
00111     // instance, i.e., checks if
00112     //    lowerBound[e] <= flow[e] <= upperBound[e]
00113     //    sum flow[e], e is outgoing edge of v -
00114     //      sum flow[e], e is incoming edge of v = supply[v] for each v
00115     // returns true iff the solution is feasible and in value the value of
00116     //   the computed flow
00117     static bool checkComputedFlow(
00118         Graph &G,
00119         EdgeArray<int> &lowerBound,
00120         EdgeArray<int> &upperBound,
00121         EdgeArray<int> &cost,
00122         NodeArray<int> &supply,
00123         EdgeArray<int> &flow,
00124         int &value);
00125 
00126     static bool checkComputedFlow(
00127         Graph &G,
00128         EdgeArray<int> &lowerBound,
00129         EdgeArray<int> &upperBound,
00130         EdgeArray<int> &cost,
00131         NodeArray<int> &supply,
00132         EdgeArray<int> &flow)
00133     {
00134         int value;
00135         return checkComputedFlow(
00136             G,lowerBound,upperBound,cost,supply,flow,value);
00137     }
00138     */
00139 };
00140 
00141 
00142 } // end namespace ogdf
00143 
00144 
00145 #endif