Skip to content

Implement next_nearest_neighbors. #31

Closed
@leburgel

Description

@leburgel

It looks like we could make use of Graphs.neighborhood_dists to create a more general function for outputting the vertices that are the k-nearest neighbors of a specified vertex, for example:

function k_nearest_neighbors(g::AbstractGraph, v, d)
  nds = neighborhood_dists(g, v, d)
  # Filter `nds` for vertices with distances equal to `d`
end

Then next_nearest_neighbors(g, v) = k_nearest_neighbors(g, v, 2).

Originally posted by @mtfishman in #18 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions