def METHOD_NAME(
    basis_vectors,
    extent,
    site_offsets,
    pbc,
    distance_atol,
    order,
):
    """For :code:`order == k`, generates all edges between up to :math:`k`-nearest
    neighbor sites (measured by their Euclidean distance). Edges are colored by length
    with colors between 0 and `order - 1` in order of increasing length."""
    positions, ids = create_padded_sites(
        basis_vectors, extent, site_offsets, pbc, order
    )
    naive_edges_by_order = get_naive_edges(
        positions,
        order * np.linalg.norm(basis_vectors, axis=1).max() + distance_atol,
        order,
    )
    colored_edges = []
    for k, naive_edges in enumerate(naive_edges_by_order):
        true_edges = set()
        for node1, node2 in naive_edges:
            # switch to real node indices
            node1 = ids[node1]
            node2 = ids[node2]
            if node1 == node2:
                raise RuntimeError(
                    f"Lattice contains self-referential edge {(node1, node2)} of order {k}"
                )
            elif node1 > node2:
                node1, node2 = node2, node1
            true_edges.add((node1, node2))
        for edge in true_edges:
            colored_edges.append((*edge, k))
    return colored_edges