Open
Graph Drawing
Framework

 v.2012.05
 

CrossingsMatrix.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_CROSSINGS_MATRIX_H
00048 #define OGDF_CROSSINGS_MATRIX_H
00049 
00050 #include <ogdf/basic/EdgeArray.h>
00051 #include <ogdf/basic/Array2D.h>
00052 #include <ogdf/layered/Hierarchy.h>
00053 
00054 namespace ogdf
00055 {
00056 
00057 //---------------------------------------------------------
00058 // CrossingsMatrix
00059 // implements crossings matrix which is used by some
00060 // TwoLayerCrossingMinimization heuristics (e.g. split) 
00061 //---------------------------------------------------------
00062 class OGDF_EXPORT CrossingsMatrix
00063 {
00064 public:
00065     CrossingsMatrix() : matrix(0,0,0,0) {
00066         m_bigM = 10000;
00067     }
00068     
00069     CrossingsMatrix(const Hierarchy &H);
00070 
00071     ~CrossingsMatrix() { }
00072 
00073     int operator()(int i, int j) const
00074     {
00075         return matrix(map[i],map[j]);
00076     }
00077 
00078     void swap(int i, int j)
00079     {
00080         map.swap(i,j);
00081     }
00082 
00084     void init(Level &L);
00085 
00087     void init(Level &L, const EdgeArray<unsigned int> *edgeSubGraph);
00088 
00089 private:
00090     Array<int> map;
00091     Array2D<int> matrix;
00093     int m_bigM; // is set to some big number in both constructors
00094 };
00095 
00096 }// end namespace ogdf
00097 
00098 #endif