How to generate directed acyclic graph with long shortest path between two nodes in python -


i want compare several routing algorithms in terms of time needed find shortest path between 2 nodes in directed acyclic graph (dag).

i wrote code algorithms, having problem generate dag computationally complex find shortest path. example, when generated 100-node dag following this approach, graph connected , combination of source , destination nodes got three-hop long route in "best" case.

any idea how overcome problem?

let graph union of path , "half complete graph". "half complete graph" (sorry silly name) graph, connect each node other nodes higher id (eg. 1 -> 2, 1 -> 3, 2 -> 3). guarantees big number of edges (due "half complete graph") , long shortest path because of path. can connect of nodes in path nodes in "half complete graph".

example

graph 14 nodes:

1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 11 - 12 11 - 13 11 - 14 12 - 13 12 - 14 13 - 14 2 - 13 4 - 14 can continue adding edges nodes 1-9 nodes 11-14 

find path between 1 , 10.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -