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

Add vertices_at_distance and next_nearest_neighbors #77

Merged
merged 6 commits into from
May 16, 2024

Conversation

JoeyT1994
Copy link
Contributor

PR which moves the nth_nearest_neighbors functionality from ITensorNetworks.jl to the GraphsExtensions module in this library.
A few short tests are added, although maybe more of the GraphsExtensions code should be tested in the future (leaving for another PR).

@mtfishman
Copy link
Member

We should assess the name of this function.

Apparently the terminology "k nearest neighbors" has a different meaning in the graph community. For example, see the function k_nearest_neighbors in older versions of NetworkX, which was renamed to average_degree_connectivity in NetworkX v3.

The closest function in NetworkX that I can find to the functionality we want here is descendants_at_distance, though the terminology "descendants" makes it seem like it is for directed graphs.

Perhaps we could call it vertices_at_distance. Additionally, it may be better to implement it using Graphs.neighborhood_dists. In that way only a single neighborhood needs to be computed, and then we can filter the vertices at a certain distance, possibly using SplitApplyCombine.jl.

@JoeyT1994
Copy link
Contributor Author

vertices_at_distance seems like a reasonable name to me. I guess k_nearest_neighbors is using k to mean degree but that is not a very transparent name.

Okay yeah it should be easier to write using neighborhood_dists rather than recursively calling the function. Let me change that.

@mtfishman
Copy link
Member

Thanks!

@mtfishman mtfishman changed the title Add nth nearest neighbors and tests Add vertices_at_distance and next_nearest_neighbors May 16, 2024
@mtfishman mtfishman merged commit a8a6d1d into ITensor:main May 16, 2024
8 of 9 checks passed
@mtfishman
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants