private void CalcIDoms() { OrderNodes(); List <IGraphNode> lstNodes = colOrderedIDoms.GetLstKeys(); while (true) { bool changed = false; foreach (IGraphNode node in lstNodes) { IGraphNode idom = null; if (!setRoots.Contains(node)) { foreach (var pred in node.GetPredecessors()) { if (colOrderedIDoms.GetWithKey(pred) != null) { idom = GetCommonIDom(idom, pred, colOrderedIDoms); if (idom == null) { break; } } } } // no idom found: merging point of two trees if (idom == null) { idom = node; } IGraphNode oldidom = colOrderedIDoms.PutWithKey(idom, node); if (!idom.Equals(oldidom)) { // oldidom is null iff the node is touched for the first time changed = true; } } if (!changed) { break; } } }