ctkDependencyGraph.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Library:   CTK
00004  
00005   Copyright (c) 2010  Kitware Inc.
00006 
00007   Licensed under the Apache License, Version 2.0 (the "License");
00008   you may not use this file except in compliance with the License.
00009   You may obtain a copy of the License at
00010 
00011       http://www.commontk.org/LICENSE
00012 
00013   Unless required by applicable law or agreed to in writing, software
00014   distributed under the License is distributed on an "AS IS" BASIS,
00015   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00016   See the License for the specific language governing permissions and
00017   limitations under the License.
00018  
00019 =========================================================================*/
00020 
00021 #ifndef __ctkDependencyGraph_h
00022 #define __ctkDependencyGraph_h
00023 
00024 // Qt includes
00025 #include <QString>
00026 #include <QList>
00027 
00028 // CTK includes
00029 #if !defined(NO_SYMBOL_EXPORT)
00030 #include "CTKCoreExport.h"
00031 #else
00032 #define CTK_CORE_EXPORT
00033 #endif
00034 
00035 class CTK_CORE_EXPORT ctkDependencyGraph
00036 {
00037 public:
00038   ctkDependencyGraph(int nvertices);
00039   ~ctkDependencyGraph();
00040   
00041   void printAdditionalInfo();
00042   void printGraph();
00043   
00045   int numberOfVertices();
00046   
00048   int numberOfEdges();
00049   
00051   bool checkForCycle();
00052   
00054   bool cycleDetected();
00055   
00057   int cycleOrigin();
00058   
00060   int cycleEnd();
00061   
00062   // The traverse of the tree will print information on standard output
00063   void setVerbose(bool verbose);
00064   
00068   void insertEdge(int from, int to);
00069 
00072   void findPaths(int from, int to, QList<QList<int>* >& paths);
00073   
00075   void findPath(int from, int to, QList<int>& path);
00076   
00079   void setEdgeListToExclude(const QList<int>& list);
00080   
00083   virtual bool shouldExcludeEdge(int edge);
00084   
00086   virtual void processEdge(int /*from*/, int /*to*/){}
00087   
00091   bool topologicalSort(QList<int>& sorted);
00092   
00093 private:
00094   class ctkInternal; 
00095   ctkInternal* Internal;
00096 };
00097 
00098 #endif
00099 
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines