/// <summary> /// Remove a subtree from the current subtree, rooted at node /// </summary> public void RemoveSubTree(GLTVertex node, GLTVertex exclude = null) { node.visited = false; vertices.Remove(node); if (node == root)//the entire subtree is destroyed.. { root = exclude; } if (node is Node) { (node as Node).ForEachChild((u) => { if (u == exclude) return IterationFlag.Continue; RemoveSubTree(u); return IterationFlag.Continue; }, subtree: true); } }
internal GLTVertex unionFind_parent = null;//will be activated when linking to a prime parent. forming the union-find data structure. //unionFind_parent will point to this GLTVertex itself when it is a set-representative. public GLTVertex Find() { if (unionFind_parent == this) return this; return unionFind_parent = unionFind_parent.Find(); }
public SplitTree() { vertices = new List<GLTVertex>(); root = null; LeafMapper = new Dictionary<int, Leaf>(); }