TreeJuxtaposer
Class TreePairs

java.lang.Object
  |
  +--TreeJuxtaposer.TreePairs

public class TreePairs
extends java.lang.Object

TreePairs store all the pairwise data structures needed for structural comparison and visulization.

Version:
Author:
Tamara Munzner, Serdar Tasiran, Li Zhang, Yunhong Zhou
See Also:
TreeJuxtaposer, Tree2Tree, AccordionDrawer.Tree, GridCell

Field Summary
(package private)  java.util.HashMap pairs
          the hash map that stores all the Tree2Tree objects.
(package private)  java.util.ArrayList trees
           
 
Constructor Summary
(package private) TreePairs()
           
 
Method Summary
(package private)  void addTree(Tree newTree, int eL)
          Add a new tree Create the data structure between the tree and all the previously added trees.
(package private)  float computeDistance(Tree source, Tree other, float a, int m)
          Computes the dissimilarity distance between source and other The distance is computed by summing up getBestCorrNode scores between each tree node in source and the best matching node in other
(package private)  TreeNode getBestCorrNode(Tree source, TreeNode n, Tree other, int el)
          Computes the node in Tree "other" whose set of descendant leaves best matches that of TreeNode n in Tree "source" The best match is the node n' maximizing the following score | S(n) Intersection S(n') | / | S(n) Union S(n') | where S(n) is the set of leaves that are descendants of node n.
(package private)  float getBestCorrNodeScore(Tree source, TreeNode n, Tree other, int el)
          Computes the matching score for the node in Tree "other" whose set of descendant leaves best matches that of TreeNode n in Tree "source" The matching score between nodes n and n' is computed as follows: | S(n) Intersection S(n') | / | S(n) Union S(n') | where S(n) is the set of leaves that are descendants of node n.
(package private)  java.util.ArrayList getBestNodeList(Tree source, TreeNode n, Tree other, int el)
           
(package private)  Tree2Tree getPair(Tree t1, Tree t2)
           
 int isRangeInRange(Tree treeA, int AMin, int AMax, Tree treeB, int BMin, int BMax)
          given a node range in one tree, say whether there's an overlap with the node range in the other tree.
(package private)  void removeTree(Tree deletedTree)
          remove a tree and the relevant tree pairs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

trees

java.util.ArrayList trees

pairs

java.util.HashMap pairs
the hash map that stores all the Tree2Tree objects. the pairs are indexed first by the key of one tree in the pair and then by the key of the other tree in the pair. a better solution would be to use the key pair to index each pair. but since the number of trees is small and is likely in the range fewer than 10, it does not really matter how we implement it.

Constructor Detail

TreePairs

TreePairs()
Method Detail

addTree

void addTree(Tree newTree,
             int eL)
Add a new tree Create the data structure between the tree and all the previously added trees.


getPair

Tree2Tree getPair(Tree t1,
                  Tree t2)

removeTree

void removeTree(Tree deletedTree)
remove a tree and the relevant tree pairs

See Also:
Tree2Tree.close, TreeJuxtaposer.deleteTree

getBestCorrNode

TreeNode getBestCorrNode(Tree source,
                         TreeNode n,
                         Tree other,
                         int el)
Computes the node in Tree "other" whose set of descendant leaves best matches that of TreeNode n in Tree "source" The best match is the node n' maximizing the following score | S(n) Intersection S(n') | / | S(n) Union S(n') | where S(n) is the set of leaves that are descendants of node n.

See Also:
AccordionDrawer.Tree, AccordionDrawer.TreeNode, TreeJuxtaposer.NodeScorePair

getBestNodeList

java.util.ArrayList getBestNodeList(Tree source,
                                    TreeNode n,
                                    Tree other,
                                    int el)

getBestCorrNodeScore

float getBestCorrNodeScore(Tree source,
                           TreeNode n,
                           Tree other,
                           int el)
Computes the matching score for the node in Tree "other" whose set of descendant leaves best matches that of TreeNode n in Tree "source" The matching score between nodes n and n' is computed as follows: | S(n) Intersection S(n') | / | S(n) Union S(n') | where S(n) is the set of leaves that are descendants of node n.

See Also:
AccordionDrawer.Tree, AccordionDrawer.TreeNode, TreeJuxtaposer.NodeScorePair

computeDistance

float computeDistance(Tree source,
                      Tree other,
                      float a,
                      int m)
                throws java.lang.Exception
Computes the dissimilarity distance between source and other The distance is computed by summing up getBestCorrNode scores between each tree node in source and the best matching node in other
 mode 0: alpha is the cut off
 1: (1-s)^\alpha
 2: 1-s^{1/\alpha}
 

java.lang.Exception

isRangeInRange

public int isRangeInRange(Tree treeA,
                          int AMin,
                          int AMax,
                          Tree treeB,
                          int BMin,
                          int BMax)
                   throws java.lang.Exception
given a node range in one tree, say whether there's an overlap with the node range in the other tree. returns number of overlapping nodes, possibly 0

java.lang.Exception