//Proposition 4.15 internal void AttachToPrimeNode(PrimeNode primeNode, int xId) { MarkerVertex v = new MarkerVertex(); Leaf x = new Leaf() { id = xId, opposite = v, parent = primeNode, }; v.opposite = x; HashSet<MarkerVertex> list = new HashSet<MarkerVertex>(); primeNode.ForEachMarkerVertex((u) => { if (u.perfect) list.Add(u); return IterationFlag.Continue; }); primeNode.AddMarkerVertex(v, list); primeNode.lastMarkerVertex = v; AddLeaf(x); }
internal PrimeNode ConvertToPrime() { PrimeNode ret = new PrimeNode() { rootMarkerVertex = rootMarkerVertex, visited = visited, parentLink = parentLink, unionFind_parent = unionFind_parent, universalMarkerVetex = null,//really not determined right now.. Gu = new Dictionary<MarkerVertex,HashSet<MarkerVertex>>() }; rootMarkerVertex.node = ret; GLTVertex rep = null; foreach (var v in Vu) { if (v == rootMarkerVertex) continue; if (rep == null) { rep = v.GetOppositeGLTVertex(); rep.parentLink = ret; rep.unionFind_parent = rep; } else { var o = v.GetOppositeGLTVertex(); o.parentLink = null; o.unionFind_parent = rep; } } if (isClique) { foreach (var v in Vu) { HashSet<MarkerVertex> n = new HashSet<MarkerVertex>(); foreach (var w in Vu) { if (w == v) continue; n.Add(w); } ret.Gu.Add(v, n); } } else { foreach (var v in Vu) { if (v == center) { HashSet<MarkerVertex> n = new HashSet<MarkerVertex>(); foreach (var w in Vu) { if (w == v) continue; n.Add(w); } ret.Gu.Add(v, n); } else { ret.Gu.Add(v, new HashSet<MarkerVertex> { center }); } } } return ret; }
internal override GLTVertex Clone() { PrimeNode newPrimeNode = new PrimeNode() { activeTimestamp = activeTimestamp, Gu = Gu, parentLink = parentLink, unionFind_parent = unionFind_parent, universalMarkerVetex = universalMarkerVetex, visitedTimestamp = visitedTimestamp, rootMarkerVertex = rootMarkerVertex, }; rootMarkerVertex.node = newPrimeNode; var representative = childSetRepresentative; representative.parentLink = newPrimeNode;//Thankfully we can make it in O(1) return newPrimeNode; }