public Edge getDistanceEdge(TreeNode source, TreeNode target) { int intersection = 0; double s = 0; for (TreeNode treeNodeSource : source.getPartition() .getLeavesArray()) { for (TreeNode treeNodeTarget : target.getPartition() .getLeavesArray()) { if (treeNodeSource.getLabel().equals( treeNodeTarget.getLabel())) { // if (treeNodeSource.equals(treeNodeTarget)){ intersection++; } } } s = (intersection / (Math.pow( (double) (source.getPartition().getSize() + target .getPartition().getSize()), parameter))); return new Edge(source, target, s); }
public Edge getDistanceEdge(TreeNode source, TreeNode target) { // //System.out.println("getDistance Methode: Source treeNode partition --> "+source.getPartition().toString()); // //System.out.println("getDistance Methode: Target treeNode partition --> "+target.getPartition().toString()); int intersection = 0; int union = 0; double s = 0; for (TreeNode treeNodeSource : source.getPartition() .getLeavesArray()) { for (TreeNode treeNodeTarget : target.getPartition() .getLeavesArray()) { if (treeNodeSource.getLabel().equals( treeNodeTarget.getLabel())) { // if (treeNodeSource.equals(treeNodeTarget)){ intersection++; } } } // //System.out.println("getDistance Methode: intersection --> "+intersection); union = source.getPartition().getSize() + target.getPartition().getSize() - intersection; // //System.out.println("getDistance Methode: union --> "+union); s = (double) intersection / (double) union; // //System.out.println("getDistance Methdode: Distance --> "+s); return new Edge(source, target, s); }
public Edge getDistanceEdge(TreeNode source, TreeNode target) { int intersection = 0; double s = 0; for (TreeNode treeNodeSource : source.getPartition() .getLeavesArray()) { for (TreeNode treeNodeTarget : target.getPartition() .getLeavesArray()) { if (treeNodeSource.getLabel().equals( treeNodeTarget.getLabel())) { // if (treeNodeSource.equals(treeNodeTarget)){ intersection++; } } } // //System.out.println("getDistance Methode likelihoods: intersection --> "+intersection); TreeNode getRootHelp = source; while (getRootHelp.getParent() != null) { getRootHelp = getRootHelp.getParent(); } int allLeaves = getRootHelp.getLeaves().length; s = BCNWithLikelihoods.computeValueWithDouble(allLeaves, source .getPartition().getSize(), target.getPartition().getSize(), intersection); return new Edge(source, target, s); }