MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / link

Method link

Data Structures/Top Tree.cpp:419–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

417
418 // link v2 as a child of v1 with edge e
419 friend void link(top_tree_node* e, top_tree_node* v1, top_tree_node* v2) {
420 assert(e && v1 && v2);
421 assert(!e->c[0] && !e->c[1] && !e->c[2]);
422 v1->expose(); while (v1->p) v1 = v1->p;
423 v2->make_root();
424
425 assert(!v1->p);
426 assert(!v2->p);
427
428 e->is_path = true, e->is_vert = false;
429 e->c[0] = v1;
430 v1->p = e;
431 e->c[1] = v2;
432 v2->p = e;
433 e->update();
434 }
435
436 friend std::pair<top_tree_node*, top_tree_node*> cut(top_tree_node* e) {
437 assert(!e->p);

Callers

nothing calls this directly

Calls 3

exposeMethod · 0.80
make_rootMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected