void UGraph::BST(int source) { bool *visited; visited = new bool[Nodes.size()]; for(int i = 0 ; i < Nodes.size() ;i++) visited[i] = false; if(!nodeExist(source)) std::cout<<"Node does not exist"<< std::endl; else { std::queue<int> nodeq; nodeq.push(source); while(!nodeq.empty()) { int node_i = nodeq.front(); if(!visited[node_i]) { visited[node_i] = true; std::vector<int> children = Nodes[node_i].edges(); for(int j = 0 ; j < children.size() ; j++) nodeq.push(children[j]); } nodeq.pop(); } } }
Cycle * IGraph::cycleFinding(int first, int last, int user) { if (size() == 0) return 0; if (!nodeExist(first, last, user)) return 0; return doCycleFinding(first, last, user); }
bool IGraph::updateNode(int old_first, int old_last, int old_user, float old_coef, int new_first, int new_last, int new_user, float new_coef) { if (size() == 0) return false; if (!nodeExist(old_first, old_last, old_user)) return false; return doUpdateNode(old_first, old_last, old_user, old_coef, new_first, new_last, new_user, new_coef); }
bool IGraph::deleteNode(int first, int last, int user) { if (size() <= 0) return false; if (!nodeExist(first, last, user)) return false; return doDeleteNode(first, last, user); }
bool IGraph::readNode(int first, int last, int user, Node *node) { if (size() == 0) return false; if (!nodeExist(first, last, user)) return false; return doReadNode(first, last, user, node); }