yggdrasil-network / yggdrasil-go

An experiment in scalable routing as an encrypted IPv6 overlay network
https://yggdrasil-network.github.io
Other
3.51k stars 242 forks source link

What type of tree should the yggdrasil be? #1185

Open DrAlta opened 1 week ago

DrAlta commented 1 week ago

There was talk about Minimum Spanning Tree where is was diced that a MST is probably not what we want. #280

I think what we want is the tree that has the shortest average of the short path from every node to the root then from the root to every other node.

let distances = Vec::new();
for node_a in nodes {
   let to_route = distance_to_route(node_a);
   for node_b in nodes{
      paths.push(to_root + distance_to_route(node_b));
   }
}

let value_we_want_to_minimize = distances.iter().sum() / distances.len();

which I think can be approximated be just finding the centroid of the graph.

Now there could be more than one centroid, but I think for a node's locator just choose the closest centroid with the largest ID then having special routing for the root ball that logical all the centroids have a virtual root as their parent.

You could just choose one of the centroids as the official root for locators, and all locators would by from that root to the centroid the node is rooted to.

I'm not sure if you would need to change the distance metric but a node could use information about the rootball to find a shortcut to the centroid the destination locator is rooted on.

kinda like the old UUCP bang paths where you would give how to reach your system from a commonly known system.

EugeneMartein commented 1 day ago

I don't think that's Yggdrasil's goal. That's Ironwood's goal.