Message Boards Message Boards

1
|
2990 Views
|
3 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Algorithm for nearest neighbor undirected weighted graph

Posted 4 years ago

Version 1 for adjacency matrix input. See below for tabular data input. Error reports and general feedback welcome.

POSTED BY: Richard Frost
3 Replies

Version 2, for tabular data.

POSTED BY: Richard Frost

"here’s where it’s assumed to be undirected"

This fails to account for the fact D has closest neighbor A does not imply A has closest neighbor D (it does not, A has B as closest neighbor).

POSTED BY: Daniel Lichtblau

Thanks for looking! Actually, D-A is included in edgepairs as {A, D}. The weight for that edge is then found in edgepairweights. See also the final output. I've only tested on tiny examples though. Next up are some with 100's of vertices, then on to the 1000's.

I'm curious though if weighted graphs are supported by NearestNeighborGraph[] ? https://community.wolfram.com/groups/-/m/t/1983316

POSTED BY: Richard Frost
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract