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 #22

Open
leburgel opened this issue Dec 21, 2022 · 2 comments
Open

Implement next_nearest_neighbors #22

leburgel opened this issue Dec 21, 2022 · 2 comments

Comments

@leburgel
Copy link
Contributor

Implement next_nearest_neighbors(g, v) which returns the next-to-nearest neighbors of a vertex v in g.

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 ITensor/ITensorNetworks.jl#18 (comment)

@mtfishman
Copy link
Member

Note this is implemented in ITensorNetworks but just needs to be moved over here.

@mtfishman
Copy link
Member

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

2 participants