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

Feature: Option: Add regions to graphs #36

Open
root-11 opened this issue Oct 25, 2023 · 6 comments
Open

Feature: Option: Add regions to graphs #36

root-11 opened this issue Oct 25, 2023 · 6 comments
Assignees

Comments

@root-11
Copy link
Owner

root-11 commented Oct 25, 2023

Minimal illustration of the problem

image
(classic graph vs multi-graph)

Assume G is a binary tree with a root and 2 levels if bifurcation resulting in $2^{2}$ leaves with randomized weights on the edges.

Assume that all search starts at the root and ends by identifying the route to a leaf using BFS to determine the shortest path.

Problem: Due to the symmetric nature of the graph, shortest path BFS will practically visit every node every time a search is performed.

Proposition 1: If (!) G is redesigned such that the graph is holds information about what can be found below each bifurcation point, only 10 nodes need to be visited. This is ideal from a search perspective, but the memory overhead is problematic as it requires the graph to store all leaves at all bifurcation levels: ~10x more memory. A second problem with this approach is that it only works for DAGs.

Proposition 2: If a partition of G can be declared as a another graph G' and BFS and shortest-path search can query G' to whether or not it contains or has a route to the target node, then the search can be accelerated:

  1. If the target node is in G' and BFS sees G' as a single node in G, then the destination node has been found.
  2. If the target node is NOT in G', BFS can eliminate the search through G' all together.

For the binary tree this means that G defined as $G_{1}' + G_{2}' = G_{1.1}' + G_{1.2}' + G{2.1}' + G_{2.2}...$ a BFS or shortest-path will require only $2*10$ recursive queries akin to "is target in G'".

The reason for 2*10 is because at each recursive step the binary partition will have at least one failure.

Edges cases:

For non-trees, such as road networks, which may be partitioned using the "AA", "A", "B", ... road network classification, each branch will lead to a $G_{n}'$ where knowing the probability of reaching the target (for example using (lat, lon)-distance) will help to accelerate the search, but if such information isn't available - for example in information networks - the better method is to partition by proximity e.g. in clusters of $G/2$-nodes. The search must thereby treat G' as nodes that either have been visited or not.

@root-11 root-11 changed the title Feature: MultiGraph Feature: Option: Add regions to graphs Nov 1, 2023
@04t02
Copy link
Collaborator

04t02 commented Nov 1, 2023

20,000 location graph
20000_locs.txt

@04t02
Copy link
Collaborator

04t02 commented Nov 1, 2023

40,000 locations graph
40000_locs.txt

@04t02
Copy link
Collaborator

04t02 commented Nov 1, 2023

20,000 locations as str(Coord.xyz)
graph_as_coords.txt

@root-11
Copy link
Owner Author

root-11 commented Nov 1, 2023

@04t02 for each of the graphs, what would constitute a typical region and what would a common path search look like?

@root-11
Copy link
Owner Author

root-11 commented Nov 1, 2023

I picking two random locations, I see that the paths in 20000 are very limited:

Source20047 : 1
Conveyor20045 : 1
Intersection20042 : 1
Conveyor20043 : 1
Intersection20029 : 1
Conveyor20028 : 1
Intersection20025 : 2
RackIn20015 : 1
Shuttle20005 : 4001   <--- only point of spread.
BinLocation19986 : 1 

@04t02
Copy link
Collaborator

04t02 commented Nov 1, 2023

A typical region would be Shuttle to it's corresponding BinLocations (these are bi-directional edges most easily found by looking at the connections from the Shuttle).

Common path searches would be Source to BinLocations and BinLocations to Sink. As you can see, the graph is very much like a dandelion in that the Source to Shuttle path is very simple and edge count explodes from the Shuttle to BinLocations

root-11 added a commit that referenced this issue Dec 30, 2023
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