00001 /* 00002 * steghide 0.5.1 - a steganography program 00003 * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at> 00004 * 00005 * This program is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU General Public License 00007 * as published by the Free Software Foundation; either version 2 00008 * of the License, or (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 * 00019 */ 00020 00021 #ifndef SH_DFSAPHEURISTIC 00022 #define SH_DFSAPHEURISTIC 00023 00024 #include "EdgeIterator.h" 00025 #include "MatchingAlgorithm.h" 00026 #include "Vertex.h" 00027 00028 class Edge ; 00029 #include "Graph.h" 00030 class Matching ; 00031 00040 class DFSAPHeuristic : public MatchingAlgorithm { 00041 public: 00050 DFSAPHeuristic (Graph* g, Matching* m, float goal = 100.0, UWORD32 mne = UWORD32_MAX, EdgeIterator::ITERATIONMODE mo = EdgeIterator::SAMPLEOCCURENCE) ; 00051 00052 virtual ~DFSAPHeuristic (void) ; 00053 00054 const char* getName (void) const 00055 { return "DFS Augmenting Path Heuristic" ; } ; 00056 00061 void reset (UWORD32 mne = UWORD32_MAX, EdgeIterator::ITERATIONMODE mo = EdgeIterator::SAMPLEOCCURENCE) ; 00062 00063 void run (void) ; 00064 00065 private: 00071 unsigned long searchAugmentingPath (Vertex* v0, const Edge** path) ; 00072 00073 const Edge* getNextEdge (Vertex *v) ; 00074 00075 void markVisited (Vertex *v) 00076 { TimeCounters[v->getLabel()] = TimeCounter ; } ; 00077 00082 bool isVisited (Vertex *v) const 00083 { return isVisited(v->getLabel()) ; } ; 00084 00085 bool isVisited (VertexLabel vlbl) const 00086 { return (TimeCounters[vlbl] == TimeCounter) ; } ; 00087 00088 UWORD32 TimeCounter ; 00089 UWORD32* TimeCounters ; 00090 bool* VertexOnPath ; 00091 EdgeIterator* EdgeIterators ; 00092 00093 #ifdef DEBUG 00095 unsigned long long NEdgesSuccessful ; 00097 unsigned long long NEdgesUnsuccessful ; 00099 unsigned long NSuccessful ; 00101 unsigned long NUnsuccessful ; 00103 std::string SuccessString ; 00104 #endif 00105 } ; 00106 00107 #endif // ndef SH_DFSAPHEURISTIC