def _verts_within_dist(graph, sources, max_dist):
    dist_map = {}
    verts_added_last = []
    for source in sources:
        dist_map[source] = 0
        verts_added_last.append(source)

    # add neighbors until no more neighbors within max_dist can be found
    while len(verts_added_last) > 0:
        verts_added = []
        for i in verts_added_last:
            v_dist = dist_map[i]
            row = graph[i, :]
            neighbor_vert = row.indices
            neighbor_dist = row.data
            for j, d in zip(neighbor_vert, neighbor_dist):
                n_dist = v_dist + d
                if j in dist_map:
                    if n_dist < dist_map[j]:
                        dist_map[j] = n_dist
                else:
                    if n_dist <= max_dist:
                        dist_map[j] = n_dist
                        # we found a new vertex within max_dist
                        verts_added.append(j)
        verts_added_last = verts_added

    verts = np.sort(np.array(list(dist_map.keys()), dtype=np.int))
    dist = np.array([dist_map[v] for v in verts])

    return verts, dist
Retrieve the resource at the provided URL.
dataset/ETHPy150Open mne-tools/mne-python/mne/label.py/_verts_within_dist--crossover with--dataset/ETHPy150Open reviewboard/rbtools/rbtools/api/transport/__init__.py/Transport.get_url