private void cmpTrivialInteractions(MyPhyloTree n, HashMap<MyNode, HashSet<MyNode>> nodeToPreds) {
   HashSet<MyNode> retNodes = new HashSet<MyNode>();
   for (MyNode v : n.getNodes()) {
     if (v.getInDegree() > 1) {
       retNodes.add(v);
     }
   }
   HashSet<MyEdge> toResolve = new HashSet<MyEdge>();
   for (MyNode v : retNodes) {
     Vector<MyNode> parentNodes = new Vector<MyNode>();
     Vector<MyEdge> parentEdges = new Vector<MyEdge>();
     Iterator<MyEdge> it = v.getInEdges();
     while (it.hasNext()) {
       MyEdge e = it.next();
       parentNodes.add(e.getSource());
       parentEdges.add(e);
     }
     for (MyNode p1 : parentNodes) {
       for (MyNode p2 : parentNodes) {
         if (nodeToPreds.get(p1).contains(p2)) {
           if (ancestorCheck(p1, p2)) toResolve.add(parentEdges.get(parentNodes.indexOf(p2)));
         }
       }
     }
   }
   for (MyEdge e : toResolve) trivialEdges.add(e);
 }
 private void cmpImplicitAncestorsRec(boolean b, MyNode v, Vector<MyNode> implicitAncestors) {
   if (v.getInDegree() > 1 || b) {
     Iterator<MyEdge> it = v.getInEdges();
     while (it.hasNext()) {
       MyEdge e = it.next();
       MyNode a = e.getSource();
       implicitAncestors.add(a);
       cmpImplicitAncestorsRec(v.getInDegree() != 1, a, implicitAncestors);
     }
   }
 }
 private void computeClusterRec(MyPhyloTree n, MyNode v, BitSet cluster, int treeIndex) {
   if (v.getOutDegree() == 0) cluster.set(taxaOrdering.indexOf(n.getLabel(v)));
   else {
     Iterator<MyEdge> it = n.getOutEdges(v);
     while (it.hasNext()) {
       MyEdge e = it.next();
       HashSet<Integer> indices = (HashSet<Integer>) e.getInfo();
       if (indices.contains(treeIndex)) {
         MyNode c = e.getTarget();
         computeClusterRec(n, c, cluster, treeIndex);
       }
     }
   }
 }
 private boolean checkTree(MyPhyloTree net) {
   MyPhyloTree n = new MyPhyloTree(net);
   n.setTimeDegree(null);
   HashSet<MyEdge> criticalEdges = new HashSet<MyEdge>();
   for (MyEdge e : n.getEdges()) {
     if (e.isCritical()) criticalEdges.add(e);
   }
   for (MyEdge e : criticalEdges) {
     MyNode s = e.getSource();
     MyNode t = e.getTarget();
     s.removeOutEdge(e);
     MyNode x = n.newNode();
     n.newEdge(s, x);
     n.newEdge(x, t);
   }
   CheckTimeConsistency checker = new CheckTimeConsistency();
   int k = checker.run(n, 0, false, true, -1);
   if (k != 0) return false;
   return true;
 }
 private void assingPreds(
     MyNode v, HashSet<MyNode> preds, HashMap<MyNode, HashSet<MyNode>> nodeToPreds) {
   boolean isCritical = false;
   Iterator<MyEdge> it = v.getOutEdges();
   while (it.hasNext()) {
     MyEdge e = it.next();
     if (v.getOwner().isSpecial(e)) {
       if (!nodeToPreds.containsKey(v)) nodeToPreds.put(v, (HashSet<MyNode>) preds.clone());
       else nodeToPreds.get(v).addAll(preds);
       isCritical = true;
       break;
     }
   }
   if (isCritical) preds.add(v);
   it = v.getOutEdges();
   while (it.hasNext()) {
     MyEdge e = it.next();
     assingPreds(e.getTarget(), (HashSet<MyNode>) preds.clone(), nodeToPreds);
   }
 }
 private void setEdges(Vector<MyEdge> subset) {
   for (MyEdge e : subset) e.setCritical(true);
   for (MyEdge e : trivialEdges) e.setCritical(true);
 }
 private void clearEdges(MyPhyloTree n) {
   for (MyEdge e : n.getEdges()) {
     e.setCritical(false);
   }
 }
 private boolean isClusterNode(MyNode v) {
   MyEdge outEdge = v.getOutEdges().next();
   if (((HashSet<Integer>) outEdge.getInfo()).contains(-1)) return true;
   return false;
 }