/** * Prints a cover tree starting from the given node. * * @param depth The depth of top_node. * @param top_node The node to start printing from. */ protected static void print(int depth, CoverTreeNode top_node) { print_space(depth); println(top_node.p()); if (top_node.num_children > 0) { print_space(depth); print("scale = " + top_node.scale + "\n"); print_space(depth); print("num children = " + top_node.num_children + "\n"); System.out.flush(); for (int i = 0; i < top_node.num_children; i++) { print(depth + 1, top_node.children.element(i)); // top_node.children[i]); } } }
/** * Prints a cover tree starting from the given node. * * @param depth The depth of top_node. * @param top_node The node to start printing from. */ protected static void print(int depth, CoverTreeNode top_node) { print_space(depth); println(top_node.p()); if (top_node.num_children > 0) { print_space(depth); print("scale = " + top_node.scale + "\n"); print_space(depth); print("num children = " + top_node.num_children + "\n"); System.out.flush(); for (int i = 0; i < top_node.num_children; i++) { print(depth + 1, top_node.children.element(i)); // top_node.children[i]); } } }
d_node par; MyHeap upper_k = new MyHeap(k); double d = Math.sqrt(m_DistanceFunction.distance(m_Root.p(), target, Double.POSITIVE_INFINITY, m_TreeStats)), upper_bound; cover_set_current.push(new d_node(d, m_Root)); list.insertSorted(d, m_Root.p()); return list; } else { d = upper_bound + child.max_dist; d = Math.sqrt(m_DistanceFunction.distance(child.p(), target, d * d, m_TreeStats)); if (m_TreeStats != null) { tmpnode = zero_set.element(i); if (tmpnode.dist <= upper_bound) { list.insertSorted(tmpnode.dist, tmpnode.n.p());
d_node par; MyHeap upper_k = new MyHeap(k); double d = Math.sqrt(m_DistanceFunction.distance(m_Root.p(), target, Double.POSITIVE_INFINITY, m_TreeStats)), upper_bound; cover_set_current.push(new d_node(d, m_Root)); list.insertSorted(d, m_Root.p()); return list; } else { d = upper_bound + child.max_dist; d = Math.sqrt(m_DistanceFunction.distance(child.p(), target, d * d, m_TreeStats)); if (m_TreeStats != null) { tmpnode = zero_set.element(i); if (tmpnode.dist <= upper_bound) { list.insertSorted(tmpnode.dist, tmpnode.n.p());
ele = zero_set.element(i); if (ele.dist <= upper_k.peek().distance) { temp.insertSorted(ele.dist, ele.n.p()); // temp.push(ele.n.p());
ele = zero_set.element(i); if (ele.dist <= upper_k.peek().distance) { temp.insertSorted(ele.dist, ele.n.p()); // temp.push(ele.n.p());
/** * Prints the given cover sets and zero set. * * @param cover_sets The cover sets to print. * @param zero_set The zero set to print. * @param current_scale The scale/level to start printing the cover sets from. * @param max_scale The max scale/level to print the cover sets upto. */ void print_cover_sets(Stack<Stack<d_node>> cover_sets, Stack<d_node> zero_set, int current_scale, int max_scale) { d_node ele; println("cover set = "); for (; current_scale <= max_scale; current_scale++) { println("" + current_scale); for (int i = 0; i < cover_sets.element(current_scale).length; i++) { ele = cover_sets.element(current_scale).element(i); CoverTreeNode n = ele.n; println(n.p()); } } println("infinity"); for (int i = 0; i < zero_set.length; i++) { ele = zero_set.element(i); CoverTreeNode n = ele.n; println(n.p()); } }
/** * Prints the given cover sets and zero set. * * @param cover_sets The cover sets to print. * @param zero_set The zero set to print. * @param current_scale The scale/level to start printing the cover sets from. * @param max_scale The max scale/level to print the cover sets upto. */ void print_cover_sets(Stack<Stack<d_node>> cover_sets, Stack<d_node> zero_set, int current_scale, int max_scale) { d_node ele; println("cover set = "); for (; current_scale <= max_scale; current_scale++) { println("" + current_scale); for (int i = 0; i < cover_sets.element(current_scale).length; i++) { ele = cover_sets.element(current_scale).element(i); CoverTreeNode n = ele.n; println(n.p()); } } println("infinity"); for (int i = 0; i < zero_set.length; i++) { ele = zero_set.element(i); CoverTreeNode n = ele.n; println(n.p()); } }