Home | Documentation | Download | Platforms | Projects | Mailing Lists | Version History
00001 //========================================================================== 00002 // 00003 // planarity.h 00004 // 00005 //========================================================================== 00006 // $Id: planarity.h,v 1.22 2008/02/03 18:17:08 chris Exp $ 00007 00008 #ifndef PLANARITY_H 00009 #define PLANARITY_H 00010 00011 #include <GTL/GTL.h> 00012 #include <GTL/graph.h> 00013 #include <GTL/algorithm.h> 00014 #include <GTL/st_number.h> 00015 #include <GTL/embedding.h> 00016 #include <GTL/biconnectivity.h> 00017 #include <GTL/pq_node.h> 00018 00019 __GTL_BEGIN_NAMESPACE 00020 00046 class GTL_EXTERN planarity : public algorithm 00047 { 00048 public: 00054 planarity(); 00055 00059 ~planarity(); 00060 00080 int check(graph& G); 00081 00098 int run(graph& G); 00099 00106 void reset(); 00107 00117 void calc_embedding(bool p) 00118 { 00119 emp = p; 00120 if (!emp) kup = false; 00121 } 00122 00132 bool calc_embedding () const 00133 { return emp; } 00134 00146 void calc_obstruction(bool p) 00147 { 00148 kup = p; 00149 if (kup) emp = true; 00150 } 00151 00161 bool calc_obstruction() const 00162 { 00163 return kup; 00164 } 00165 00183 void make_biconnected(bool p) 00184 { 00185 bip = p; 00186 } 00187 00196 bool make_biconnected() const 00197 { 00198 return bip; 00199 } 00200 00206 bool is_planar() const 00207 { 00208 return planar; 00209 } 00210 00219 planar_embedding& get_embedding() 00220 { 00221 return embedding; 00222 } 00223 00233 list<edge>& get_obstruction_edges() 00234 { 00235 return ob_edges; 00236 } 00237 00247 list<node>& get_obstruction_nodes() 00248 { 00249 return ob_nodes; 00250 } 00251 private: 00263 bool run_on_biconnected(graph& G, planar_embedding& em); 00264 00273 void add_to_embedding(graph& G, planar_embedding& em); 00274 00287 void correct_embedding(planar_embedding& em, 00288 st_number& st, 00289 node_map<list<direction_indicator> >& dirs); 00290 00305 void extend_embedding( 00306 node n, 00307 planar_embedding& em, 00308 node_map<int>& mark, 00309 node_map<symlist<edge>::iterator >& upward_begin); 00310 00323 void switch_to_component(graph& G, 00324 biconnectivity::component_iterator it); 00325 00343 void examine_obstruction(graph& G, 00344 st_number& st, 00345 node act, 00346 pq_node* fail, 00347 bool failed_at_root, 00348 planar_embedding& em, 00349 node_map<list<direction_indicator> >& dirs, 00350 pq_tree* PQ); 00351 00366 void dfs_bushform(node act, 00367 node_map<int>& mark, 00368 st_number& st, 00369 int stop, 00370 node_map<edge>& to_father); 00371 00372 00385 void attachment_cycle (node n, planar_embedding& em); 00386 00398 void mark_all_neighbors_of_leaves (pq_node* act, node_map<int>& mark); 00399 00413 pq_leaf* run_through_partial(q_node* partial, 00414 node_map<int>& mark, 00415 node_map<edge>& to_father, 00416 node v); 00417 00428 node up_until_marked(node act, 00429 node_map<int>& mark, 00430 node_map<edge>& to_father); 00431 00443 node up_until_marked(node act, 00444 node_map<int>& mark, 00445 st_number& st); 00446 00455 pq_leaf* search_full_leaf (pq_node* n); 00456 00465 pq_leaf* search_empty_leaf(pq_node* n); 00466 00478 void case_A(p_node* p_fail, 00479 node act, 00480 st_number& _st, 00481 node_map<edge> to_father, 00482 graph& G); 00483 00495 void case_B(p_node* p_fail, 00496 node act, 00497 st_number& _st, 00498 node_map<edge> to_father, 00499 graph& G); 00500 00515 void case_C(node* nodes, 00516 pq_leaf** leaves, 00517 st_number& _st, 00518 node_map<edge> to_father, 00519 graph& G, 00520 q_node* q_fail); 00521 00536 void case_D(node* nodes, 00537 pq_leaf** leaves, 00538 st_number& _st, 00539 node_map<edge> to_father, 00540 graph& G, 00541 q_node* q_fail); 00542 00557 void case_E(node* nodes, 00558 pq_leaf** leaves, 00559 st_number& _st, 00560 node_map<edge> to_father, 00561 graph& G, 00562 q_node* q_fail); 00563 00564 #ifdef _DEBUG 00565 00568 void write_bushform(graph& G, st_number& _st, int k, const char* name, 00569 const node_map<int>& mark, const node_map<edge>& to_father); 00570 00574 void write_node(ostream& os, int id, int label, int mark); 00575 #endif 00576 00580 list<edge> ob_edges; 00581 00585 list<node> ob_nodes; 00586 00590 planar_embedding embedding; 00591 00595 bool planar; 00596 00600 bool emp; 00601 00605 bool kup; 00606 00610 bool bip; 00611 }; 00612 00613 __GTL_END_NAMESPACE 00614 00615 #endif // PLANARITY_H 00616 00617 //-------------------------------------------------------------------------- 00618 // end of file 00619 //--------------------------------------------------------------------------
University of Passau - FMI - Theoretical Computer Science