diff --git a/deferred_planarity_test/include/mps.h b/deferred_planarity_test/include/mps.h index 4a99594..b86f430 100644 --- a/deferred_planarity_test/include/mps.h +++ b/deferred_planarity_test/include/mps.h @@ -33,6 +33,12 @@ enum node_type { AE_VIRTUAL_ROOT = 3 }; +enum mark_type { + UNMARKED = 0, + MARKED = 1, + RESERVED = 2, +}; + class node { public: @@ -116,7 +122,6 @@ public: //MARK void mark(); - static void init_mark(); void un_mark(); bool is_marked(); @@ -146,8 +151,7 @@ private: vector _essential_list; //Mark - int _mark; - static int _ref_mark; + mark_type _mark; }; class maximal_planar_subgraph_finder diff --git a/deferred_planarity_test/makefile b/deferred_planarity_test/makefile index 8a8fac8..d4b8ada 100644 --- a/deferred_planarity_test/makefile +++ b/deferred_planarity_test/makefile @@ -31,4 +31,4 @@ $(BIN_DIR) $(OBJ_DIR): .PHONY: clean clean: - rm -r $(BIN_DIR) $(OBJ_DIR) + rm -r $(OBJ_DIR) diff --git a/deferred_planarity_test/src/main.cpp b/deferred_planarity_test/src/main.cpp index acb33a7..d553325 100644 --- a/deferred_planarity_test/src/main.cpp +++ b/deferred_planarity_test/src/main.cpp @@ -13,7 +13,6 @@ #include #include -#define START_TEMP 100 using namespace std; diff --git a/deferred_planarity_test/src/mps.cpp b/deferred_planarity_test/src/mps.cpp index 0c07fbd..f93a52c 100644 --- a/deferred_planarity_test/src/mps.cpp +++ b/deferred_planarity_test/src/mps.cpp @@ -34,7 +34,13 @@ maximal_planar_subgraph_finder::return_post_order() { //Determine the post-order-list by a DFS-traversal. void maximal_planar_subgraph_finder::postOrderTraversal() { - node::init_mark(); + // node::init_mark(); // set ref_mark + + // print out the ref_mark + // std::cout << "normal post order traversal" << std::endl; + // std::cout << "the ref mark is initialized to be:" << std::endl; + // _node_list[0]->print_ref_mark(); + // always start with node 0 int postOrderID = 0; for (int i = 0; i < _node_list.size(); ++i) { @@ -50,7 +56,7 @@ maximal_planar_subgraph_finder::postOrderTraversal() { // return is by reference via _post_order_list void maximal_planar_subgraph_finder::guidedPostOrderTraversal(vector post_order) { - node::init_mark(); + // node::init_mark(); vector rev_post_order; for (int i = post_order.size() - 1; i >= 0; --i) { @@ -86,7 +92,7 @@ maximal_planar_subgraph_finder::guidedPostOrderTraversal(vector post_order) // return is by reference via _post_order_list void maximal_planar_subgraph_finder::mutatedPostOrderTraversal(vector post_order, int mutate_point) { - node::init_mark(); + // node::init_mark(); vector rev_post_order; for (int i = post_order.size() - 1; i >= 0; --i) { diff --git a/deferred_planarity_test/src/node.cpp b/deferred_planarity_test/src/node.cpp index 6ce6378..1e6c7d9 100644 --- a/deferred_planarity_test/src/node.cpp +++ b/deferred_planarity_test/src/node.cpp @@ -5,7 +5,7 @@ #include "mps.h" // #define DEBUG -#define DEBUG_MUTATION +// #define DEBUG_MUTATION //----------------------------------------------------------------------------------- // CONSTRUCTOR @@ -20,7 +20,7 @@ node::node(node_type t) { _parent = 0; _post_order_index = INT_MAX; _node_id = INT_MAX; - _mark = 0; + _mark = UNMARKED; } //----------------------------------------------------------------------------------- @@ -57,7 +57,7 @@ node* node::adj(int i) {return _adj_list[i];} void node::set_adj_list(vector vec) {_adj_list = vec;} void node::DFS_visit(vector &dfsList, int &index) { - mark(); + mark(); // set _mark to _ref_mark for (int i = 0; i < _adj_list.size(); ++i) { if (!_adj_list[i]->is_marked()) { _adj_list[i]->_parent = this; @@ -358,12 +358,8 @@ void node::add_essential(node* u) {_essential_list.push_back(u);} //----------------------------------------------------------------------------------- // MARK //----------------------------------------------------------------------------------- -void node::mark() {_mark = _ref_mark;} +void node::mark() {_mark = MARKED;} -void node::init_mark() {++_ref_mark;} +void node::un_mark() {_mark = UNMARKED;} -void node::un_mark() {_mark = 0;} - -bool node::is_marked() {return _mark == _ref_mark;} - -int node::_ref_mark = 1; +bool node::is_marked() {return _mark == MARKED;} \ No newline at end of file