Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement next_nearest_neighbors. #31

Closed
leburgel opened this issue Dec 21, 2022 · 1 comment
Closed

Implement next_nearest_neighbors. #31

leburgel opened this issue Dec 21, 2022 · 1 comment

Comments

@leburgel
Copy link
Contributor

leburgel commented Dec 21, 2022

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)

@leburgel
Copy link
Contributor Author

Was supposed to go in NamedGraphs.jl instead...

@leburgel leburgel changed the title This would be nice functionality to have, and is worth splitting off into a separate function (next_nearest_neighbors?). Implement next_nearest_neighbors. Dec 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant