public static Vector<PhyloTreeEdge> getCommonEdges(PhyloTree t1, PhyloTree t2) {
        Vector<PhyloTreeEdge> commonEdges = new Vector<PhyloTreeEdge>();

        // if the two trees do not have the same leaf2NumMap
        if (!(t1.getLeaf2NumMap().equals(t2.getLeaf2NumMap()))) {
            System.out.println("Error: the two trees do not have the same leaves!");
            System.out.println("First tree's leaves are " + t1.getLeaf2NumMap());
            System.out.println("Second tree's leaves are " + t2.getLeaf2NumMap());
            throw new RuntimeException();
        }

        for (PhyloTreeEdge e1 : t1.edges) {
            // check that the split is not 0 (has no leaves and can be thought of as a null split; ignore such edges)
            if (!e1.isZero()) {
                if (t2.getSplits().contains(e1.asSplit())) {
                    // then we have found the same split in each tree
                    EdgeAttribute commonAttrib = EdgeAttribute.difference(e1.getAttribute(), t2.getAttribOfSplit(e1.asSplit()));
                    commonEdges.add(new PhyloTreeEdge(e1.asSplit(), commonAttrib, e1.getOriginalID()));
                }
                // otherwise check if the split is compatible with all splits in t2
                else if (e1.isCompatibleWith(t2.getSplits())) {
                    EdgeAttribute commonAttrib = EdgeAttribute.difference(e1.getAttribute(), null);
                    commonEdges.add(new PhyloTreeEdge(e1.asSplit(), commonAttrib, e1.getOriginalID()));
                }
            }
        }
        // check for splits in t2 that are compatible with all splits in t1
        for (PhyloTreeEdge e2 : t2.getEdges()) {
            if (!e2.isZero()) {
                if (e2.isCompatibleWith(t1.getSplits()) && !(t1.getSplits().contains(e2.asSplit()))) {
                    EdgeAttribute commonAttrib = EdgeAttribute.difference(null, e2.getAttribute());
                    commonEdges.add(new PhyloTreeEdge(e2.asSplit(), commonAttrib, e2.getOriginalID()));
                }
            }
        }
        return commonEdges;
    }