00001 /* 00002 * $Revision: 1.2 $ 00003 * 00004 * last checkin: 00005 * $Author: gutwenger $ 00006 * $Date: 2007-11-08 16:10:37 +0100 (Do, 08 Nov 2007) $ 00007 ***************************************************************/ 00008 00052 #ifndef OGDF_GRAPH_REDUCTION_H 00053 #define OGDF_GRAPH_REDUCTION_H 00054 00055 00056 #include <ogdf/basic/NodeArray.h> 00057 #include <ogdf/basic/EdgeArray.h> 00058 #include <ogdf/basic/SList.h> 00059 #include <ogdf/basic/CombinatorialEmbedding.h> 00060 00061 00062 namespace ogdf { 00063 00064 00065 //--------------------------------------------------------- 00066 // GraphReduction 00067 // kick leaves & chains 00068 // GraphReduction is read-only !!! 00069 //--------------------------------------------------------- 00070 class GraphReduction : public Graph { 00071 protected: 00072 00073 const Graph *m_pGraph; // original graph 00074 NodeArray<node> m_vOrig; // corresponding node in original graph 00075 EdgeArray<List<edge> > m_eOrig; // corresponding edge in original graph 00076 00077 NodeArray<node> m_vReduction; // corresponding node in graph copy 00078 EdgeArray<edge> m_eReduction; // corresponding chain of edges in graph copy 00079 00080 GraphReduction() : m_vOrig(), m_eOrig(), m_vReduction(), m_eReduction() {} 00081 00082 public: 00083 // construction 00084 GraphReduction(const Graph& G); 00085 virtual ~GraphReduction() {}; 00086 00087 // returns original graph 00088 const Graph &original() const { return *m_pGraph; } 00089 00090 // returns original node 00091 node original(node v) const { return m_vOrig[v]; } 00092 // returns original edges 00093 const List<edge> &original(edge e) const { return m_eOrig[e]; } 00094 00095 // returns reduction of node v (0 if none) 00096 node reduction(node v) const { return m_vReduction[v]; } 00097 // returns reduction of edge e 00098 edge reduction(edge e) const { return m_eReduction[e]; } 00099 00100 }; // class GraphCopy 00101 00102 00103 } // end namespace ogdf 00104 00105 #endif