private static bool IsContainedBy(ISubGraphModel model, Object p, Object part) { // model will not be an ILinksModel if (p == null || part == null) return false; Object sg = model.GetGroupForNode(p); if (sg == null) return false; if (sg == part) return true; if (IsContainedBy(model, sg, part)) return true; return false; }
private static Object CommonSubGraph(ISubGraphModel model, Object a, Object b) { // model will not be an ILinksModel if (a == null) return null; if (b == null) return null; Object asg = model.GetGroupForNode(a); if (asg == null) return null; if (a == b) return asg; Object bsg = model.GetGroupForNode(b); if (bsg == null) return null; if (asg == bsg) return bsg; if (IsContainedBy(model, b, asg)) return asg; if (IsContainedBy(model, a, bsg)) return bsg; return CommonSubGraph(model, asg, bsg); }