Return the distance between nodes ``u`` and ``v`` in this ``Tree``

        Args:
            ``u`` (``Node``): Node ``u``

            ``v`` (``Node``): Node ``v``

        Returns:
            ``float``: The distance between nodes ``u`` and ``v``
321386
def distance_between(self, u, v):
        '''
        '''
        if not isinstance(u, Node):
            raise TypeError("u must be a Node")
        if not isinstance(v, Node):
            raise TypeError("v must be a Node")
        if u == v:
            return 0.
        u_dists = {u:0.}; v_dists = {v:0.}
        c = u; p = u.parent # u traversal
        while p is not None:
            u_dists[p] = u_dists[c]
            if c.edge_length is not None:
                u_dists[p] += c.edge_length
            c = p; p = p.parent
        c = v; p = v.parent # v traversal
        while p is not None:
            v_dists[p] = v_dists[c]
            if c.edge_length is not None:
                v_dists[p] += c.edge_length
            if p in u_dists:
                return u_dists[p] + v_dists[p]
            c = p; p = p.parent
        raise RuntimeError("u and v are not in the same Tree")
847164
def getRawIdent(self, node):
        
        if node is self:
            return node
        ident = getattr(node, 'graphident', None)
        return ident
412907
def distanceTo(self, tree):
        '''
        
        '''
        return ViewClient.distance(ViewClient.__pickleable(self.views), tree)
1237599
def distance(self, other):
        
        return distance(self.lat, self.lon, None, other.lat, other.lon, None)
1278084
def stem(u, v, dfs_data):
    """"""
    #return dfs_data['graph'].get_first_edge_id_by_node_ids(u, v)
    uv_edges = dfs_data['graph'].get_edge_ids_by_node_ids(u, v)
    buv_edges = B(u, v, dfs_data)
    for edge_id in uv_edges:
        if edge_id in buv_edges:
            return edge_id
    return None
988519
public void calcCost(Node node)
    {
        node.cost = 0.0;
        if (alphaFloat_ != null)
        {
            float c = 0.0f;
            for (int i = 0; node.fVector.get(i) != -1; i++)
            {
                c += alphaFloat_[node.fVector.get(i) + node.y];
            }
            node.cost = costFactor_ * c;
        }
        else
        {
            double c = 0.0;
            for (int i = 0; node.fVector.get(i) != -1; i++)
            {
                c += alpha_[node.fVector.get(i) + node.y];
            }
            node.cost = costFactor_ * c;
        }
    }
574604
def get_distance_to(self, origin=None, other_atoms=None, sort=False):
        
        if origin is None:
            origin = np.zeros(3)
        elif pd.api.types.is_list_like(origin):
            origin = np.array(origin, dtype='f8')
        else:
            origin = self.loc[origin, ['x', 'y', 'z']]

        if other_atoms is None:
            other_atoms = self.index

        new = self.loc[other_atoms, :].copy()
        norm = np.linalg.norm
        try:
            new['distance'] = norm((new - origin).loc[:, ['x', 'y', 'z']],
                                   axis=1)
        except AttributeError:
            # Happens if molecule consists of only one atom
            new['distance'] = norm((new - origin).loc[:, ['x', 'y', 'z']])
        if sort:
            new.sort_values(by='distance', inplace=True)
        return new
1083608
def distance(self, x, y):
        
        if scipy.sparse.issparse(x):
            return numpy.linalg.norm((x-y).toarray().ravel())
        else:
            return numpy.linalg.norm(x-y)
964797
function convertDistance (distance) {
  let cleaned, converted;

  // clean up to ensure node-units will be able to convert it
  // for instance: "3 258,55 Ft" => "3258.55 ft"
  cleaned = distance
    .replace(/[-\s]/g, '')
    .replace(/,/g, '.')
    .toLowerCase()
    .replace(/([0-9])([a-z])/, '$1 $2');

  try {
    converted = units.convert(cleaned + ' to m');
  }
  catch (e) {
    throw new BadRequestError(`unable to parse distance value "${distance}"`);
  }

  return converted;
}
440556
def _precompute(self, tree):
        
        d = {}
        for n in tree.preorder_internal_node_iter():
            d[n] = namedtuple('NodeDist', ['dist_from_root', 'edges_from_root'])
            if n.parent_node:
                d[n].dist_from_root = d[n.parent_node].dist_from_root + n.edge_length
                d[n].edges_from_root = d[n.parent_node].edges_from_root + 1
            else:
                d[n].dist_from_root = 0.0
                d[n].edges_from_root = 0
        return d
802395
def rsdl_sn(self, U):
        

        return self.rho * np.linalg.norm(self.cnst_AT(U))
792009
def distance_to(self, *args):
        """"""
        if not len(args) > 0:
            raise ValueError("at least one parameter must be given")

        x = args[0]
        if len(args) > 1:
            unit = args[1]
        else:
            unit = "px"
        u = {"px": (1.,1.), "in": (1.,72.), "cm": (2.54, 72.),
             "mm": (25.4, 72.)}
        f = u[unit][0] / u[unit][1]
        if type(x) is Point:
            return abs(self - x) * f

# from here on, x is a rectangle
# as a safeguard, make a finite copy of it
        r = Rect(x.top_left, x.top_left)
        r = r | x.bottom_right
        if self in r:
            return 0.0
        if self.x > r.x1:
            if self.y >= r.y1:
                return self.distance_to(r.bottom_right, unit)
            elif self.y <= r.y0:
                return self.distance_to(r.top_right, unit)
            else:
                return (self.x - r.x1) * f
        elif r.x0 <= self.x <= r.x1:
            if self.y >= r.y1:
                return (self.y - r.y1) * f
            else:
                return (r.y0 - self.y) * f
        else:
            if self.y >= r.y1:
                return self.distance_to(r.bottom_left, unit)
            elif self.y <= r.y0:
                return self.distance_to(r.top_left, unit)
            else:
                return (r.x0 - self.x) * f
815051
def get_distance_term(self, C, rup, rjb, imt):
        
        h = self._get_h(C, rup.hypo_depth)
        rval = np.sqrt(rjb ** 2. + h ** 2.)
        c3 = self.get_distance_coefficients(C, imt)

        f_r = (C["c1"] + C["c2"] * (rup.mag - self.CONSTANTS["Mref"])) *\
            np.log(rval / self.CONSTANTS["Rref"]) +\
            c3 * (rval - self.CONSTANTS["Rref"])
        return f_r
782099
def distance(tree1, tree2):
        '''
        
        '''
        ################################################################
        #FIXME: this should copy the entire tree and then transform it #
        ################################################################
        pickleableTree1 = ViewClient.__pickleable(tree1)
        pickleableTree2 = ViewClient.__pickleable(tree2)
        s1 = pickle.dumps(pickleableTree1)
        s2 = pickle.dumps(pickleableTree2)

        if DEBUG_DISTANCE:
            print >>sys.stderr, "distance: calculating distance between", s1[:20], "and", s2[:20]

        l1 = len(s1)
        l2 = len(s2)
        t = float(max(l1, l2))

        if l1 == l2:
            if DEBUG_DISTANCE:
                print >>sys.stderr, "distance: trees have same length, using Hamming distance"
            return ViewClient.__hammingDistance(s1, s2)/t
        else:
            if DEBUG_DISTANCE:
                print >>sys.stderr, "distance: trees have different length, using Levenshtein distance"
            return ViewClient.__levenshteinDistance(s1, s2)/t
721494
def length_from_nodelist(self, nodelist):
        """"""
        cost = 0

        for n1, n2 in zip(nodelist[0:len(nodelist) - 1], nodelist[1:len(nodelist)]):
            cost += self._problem.distance(n1, n2)

        return cost
587906
def length(self):
        
        length = float(sum(i.length(self.vertices)
                           for i in self.entities))
        return length
126617
def path_distance(points):
    
    vecs = np.diff(points, axis=0)[:, :3]
    d2 = [np.dot(p, p) for p in vecs]
    return np.sum(np.sqrt(d2))