Open
Graph Drawing
Framework

 v.2012.05
 

LongestPathRanking.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  
00043 #ifdef _MSC_VER
00044 #pragma once
00045 #endif
00046 
00047 #ifndef OGDF_LONGEST_PATH_RANKING_H
00048 #define OGDF_LONGEST_PATH_RANKING_H
00049 
00050 
00051 
00052 #include <ogdf/module/RankingModule.h>
00053 #include <ogdf/module/AcyclicSubgraphModule.h>
00054 #include <ogdf/basic/ModuleOption.h>
00055 #include <ogdf/basic/SList.h>
00056 #include <ogdf/basic/tuples.h>
00057 #include <ogdf/basic/NodeArray.h>
00058 
00059 
00060 namespace ogdf {
00061 
00062     class OGDF_EXPORT GraphCopySimple;
00063     class OGDF_EXPORT GraphAttributes;
00064 
00065 
00067 
00115 class OGDF_EXPORT LongestPathRanking : public RankingModule {
00116 
00117     ModuleOption<AcyclicSubgraphModule> m_subgraph; 
00118     bool m_sepDeg0; 
00119     bool m_separateMultiEdges; 
00120     bool m_optimizeEdgeLength; 
00121     bool m_alignBaseClasses;   
00122     bool m_alignSiblings;      
00123 
00124     int m_offset, m_maxN;
00125 
00126     NodeArray<bool> m_isSource, m_finished;
00127     NodeArray<SListPure<Tuple2<node,int> > > m_adjacent;
00128     NodeArray<int> m_ingoing;
00129 
00130 public:
00132     LongestPathRanking();
00133 
00134 
00140 
00141     void call(const Graph &G, NodeArray<int> &rank);
00142 
00144 
00149     void call(const Graph &G, const EdgeArray<int> &length, NodeArray<int> &rank);
00150 
00152     void callUML(const GraphAttributes &AG, NodeArray<int> &rank);
00153 
00154 
00160 
00161 
00164     bool separateDeg0Layer() const { return m_sepDeg0; }
00165 
00167     void separateDeg0Layer (bool sdl) { m_sepDeg0 = sdl; }
00168 
00170 
00175     bool separateMultiEdges() const { return m_separateMultiEdges; }
00176 
00178     void separateMultiEdges(bool b) { m_separateMultiEdges = b; }
00179 
00181 
00187     bool optimizeEdgeLength() const { return m_optimizeEdgeLength; }
00188 
00190     void optimizeEdgeLength(bool b) { m_optimizeEdgeLength = b; }
00191 
00193     bool alignBaseClasses() const { return m_alignBaseClasses; }
00194 
00196     void alignBaseClasses(bool b) { m_alignBaseClasses = b; }
00197 
00199     bool alignSiblings() const { return m_alignSiblings; }
00200 
00202     void alignSiblings(bool b) { m_alignSiblings = b; }
00203 
00204 
00210 
00211     void setSubgraph(AcyclicSubgraphModule *pSubgraph) {
00212         m_subgraph.set(pSubgraph);
00213     }
00214 
00216 
00217 private:
00219     void doCall(const Graph& G,
00220         NodeArray<int> &rank,
00221         EdgeArray<bool> &reversed,
00222         const EdgeArray<int> &length);
00223 
00224     void join(
00225         GraphCopySimple &GC,
00226         NodeArray<node> &superNode,
00227         NodeArray<SListPure<node> > &joinedNodes,
00228         node v, node w);
00229 
00230     void dfs(node v);
00231     void getTmpRank(node v, NodeArray<int> &rank);
00232     void dfsAdd(node v, NodeArray<int> &rank);
00233 };
00234 
00235 
00236 } // end namespace ogdf
00237 
00238 
00239 #endif