ethanjweiner / visualize-the-web

A geographic visualizer of HTTP requests across long distances, built with Python and Flask
2 stars 1 forks source link

Implement route() method of the Router class #26

Closed ethanjweiner closed 3 years ago

ethanjweiner commented 3 years ago

Task Title

Task: Implement route() method of the Router class

Task Description

This Task will...

Epic Parent

Feature: Awesome Feature Title

ethanjweiner commented 3 years ago

Ideas:

We have access to a list of all the routers, the destination, and the path travelled so far. How can we move one step closer to the destination?

Use some searching algorithm to help with this (e.g. BFS?)

ethanjweiner commented 3 years ago

Idea:

Research search algorithms for disconnected graphs

ethanjweiner commented 3 years ago

Spatial indices: Ways to arrange geometric data for efficient search -- e.g. find all the routers in this area

e.g. Organizing all the points into boxes such that we can use a tree-like data structure to recursively zoom in on boxes that touch the point of interest.

We will not be using spatial indices, since we aren't dealing with a ton of data -- we can use the more naive approaches of looping through all points.

However, we can maybe create something similar in practice. At the very least, we could label the continent that each router is located in.

ethanjweiner commented 3 years ago

Idea: Use a BFS (breadth-first-search like algorithm):

Heuristic: Distance from destination

We can tweak this algorithm (e.g. add more randomness; change router cap) as we go. But this seems like a good starting point. I'd rather introduce randomness/chaos, than start with chaos in the beginning.

ethanjweiner commented 3 years ago

Consider setting up a playground for testing these routing functions . . .

ethanjweiner commented 3 years ago

Potential edge case: The destination is isolated from other routers. Problem: The routers will simply keep jumping back and forth between each one. Solution: Avoiding circular cases --- at first, the algorithm will jump to the closest neighbors. But once those neighbors become part of the path, they can no longer be added to the path --- and so the algorithm will instead search in a further radius --- and try to find the destination.