Open
Graph Drawing
Framework

 v.2012.05
 

GraphReduction.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  
00044 #ifndef OGDF_GRAPH_REDUCTION_H
00045 #define OGDF_GRAPH_REDUCTION_H
00046 
00047 
00048 #include <ogdf/basic/NodeArray.h>
00049 #include <ogdf/basic/EdgeArray.h>
00050 #include <ogdf/basic/SList.h>
00051 #include <ogdf/basic/CombinatorialEmbedding.h>
00052 
00053 
00054 namespace ogdf {
00055 
00056 
00057 //---------------------------------------------------------
00058 // GraphReduction
00059 // kick leaves & chains
00060 // GraphReduction is read-only !!!
00061 //---------------------------------------------------------
00062 class OGDF_EXPORT GraphReduction : public Graph {
00063 protected:
00064 
00065     const Graph *m_pGraph; // original graph
00066     NodeArray<node> m_vOrig; // corresponding node in original graph
00067     EdgeArray<List<edge> > m_eOrig; // corresponding edge in original graph
00068 
00069     NodeArray<node> m_vReduction; // corresponding node in graph copy
00070     EdgeArray<edge> m_eReduction; // corresponding chain of edges in graph copy
00071     
00072     GraphReduction() : m_vOrig(), m_eOrig(), m_vReduction(), m_eReduction() {}
00073 
00074 public:
00075     // construction
00076     GraphReduction(const Graph& G);
00077     virtual ~GraphReduction() {};
00078 
00079     // returns original graph
00080     const Graph &original() const { return *m_pGraph; }
00081 
00082     // returns original node
00083     node original(node v) const { return m_vOrig[v]; }
00084     // returns original edges
00085     const List<edge> &original(edge e) const { return m_eOrig[e]; }
00086 
00087     // returns reduction of node v (0 if none)
00088     node reduction(node v) const { return m_vReduction[v]; }
00089     // returns reduction of edge e
00090     edge reduction(edge e) const { return m_eReduction[e]; }
00091 
00092 }; // class GraphCopy
00093 
00094 
00095 } // end namespace ogdf
00096 
00097 #endif