Shortest Path Comparison - HelenYunes/OOP_Ex3 GitHub Wiki
shortest_path()
The third and last method we'll be comparing and testing is shortest_path(src, dest). This method finds the shortest path between two nodes(src --> dest) taking into account the weight of the edges between them. The test is performed from a Python file and a Java file which runs the method on the same graph and calculates the runtime of each method on a given graphs with the use of the Time library. Then also compared with the Networkx's method. Here are the results for our code in Python and Networkx's head to head:
and this are the results in java:
As we can tell suprisingly with this method, here the Java method outpeforms the python (unlike the two other mrthod) while the netwokx's method outperforms our Java and python methods as shown in a graph:
As we can also tell as we test larger graphs the difference starts to grow which is shown in the diagram:
In conclusion we can say that our Java method outperforms the python method. While the difference is quite negligible on the smaller graphs, as they get larger the difference starts to really show. Networkx's method runtime is better than both our Java and python methods.