Skip to content

Comparing our Java project VS. Python VS. NetworkX python lib

shaCode256 edited this page Mar 4, 2021 · 1 revision

shortestPath() algorithm function runtime comparison:

a

SCC algorithms functions runtime comparison:

a Ex2 Java project VS. Ex3 Python project checking shortestPath from node with key 0 to a node with key 4 Ex3- time in sec Ex2-time in sec Graph name 0.000 0.035 G_10_80_1.json 0.001 0.035 G_100_800_1.json 0.230 0.158 G_1000_8000_1.json 34.725 1.246 G_10000_80000_1.json 129.806 3.849 G_20000_160000_1.json 371.778 10.094 G_30000_240000_1.json

Networkx- time in sec Graph Name 0.000 G_10_80_1.json 0.000 G_100_800_1.json 0.002 G_1000_8000_1.json 0.228 G_10000_80000_1.json 0.521 G_20000_160000_1.json 0.613 G_30000_240000_1.json

נכונות האלגוריתמים: בכל האלגוריתמים יצאו אותן התוצאות:

Weight of path List Graph name 1.4254324246464245 [0, 4] G_10_80_1.json 29.14407437224567 [0, 1, 4] G_100_800_1.json 27.00569088191026 [0, 371, 233, 4] G_1000_8000_1.json 99.2798668896577 [0, 9624, 2121, 8592, 3136, 7829, 6805, 4] G_10000_80000_1.json 125.17665968464343 [0, 5855, 4630, 352, 10238, 11183, 4872, 6874, 9707, 7676, 4] G_20000_160000_1.json 123.37112242332906 [0, 27764, 5574, 25737, 16604, 18307, 15273, 19586, 12002, 14489, 14370, 12768, 3852, 4] G_30000_240000_1.json

ShortestPath in Java logs:

@Test void test_javaComparisonJson1() throws IOException { System.out.println("reading from file..."+ag1.load("G_10_80_1.json")); System.out.println("shortestPath is "+ag1.shortestPathDist(0, 4)); }

@Test void test_javaComparisonJson2() throws IOException { System.out.println("reading from file..."+ag1.load("G_100_800_1")); System.out.println("shortestPath is "+ag1.shortestPathDist(0, 4)); }

@Test void test_javaComparisonJson3() throws IOException { System.out.println("reading from file..."+ag1.load("G_1000_8000_1")); System.out.println("shortestPath is "+ag1.shortestPathDist(0, 4)); }

@Test void test_javaComparisonJson4() throws IOException { System.out.println("reading from file..."+ag1.load("G_10000_80000_1")); System.out.println("shortestPath is "+ag1.shortestPathDist(0, 4)); }

@Test void test_javaComparisonJson5() throws IOException { System.out.println("reading from file..."+ag1.load("G_20000_160000_1")); System.out.println("shortestPath is "+ag1.shortestPathDist(0, 4)); }

@Test void test_javaComparisonJson6() throws IOException { System.out.println("reading from file..."+ag1.load("G_30000_240000_1")); System.out.println("shortestPath is "+ag1.shortestPathDist(0, 4)); }

Ex2: Setting up the environment. creating the graphs... operating on file: G_10_80_1.json reading from file...true shortestPathList is [0, 4] shortestPathDist is 1.4254324246464245 This test took 0.049 seconds Setting up the environment. creating the graphs... operating on file: G_100_800_1.json reading from file...true shortestPathList is [0, 1, 4] shortestPathDist is 29.14407437224567 This test took 0.052 seconds Setting up the environment. creating the graphs... operating on file: G_1000_8000_1.json reading from file...true shortestPathList is [0, 371, 233, 4] shortestPathDist is 27.00569088191026 This test took 0.224 seconds Setting up the environment. creating the graphs... operating on file: G_10000_80000_1.json reading from file...true shortestPathList is [0, 9624, 2121, 8592, 3136, 7829, 6805, 4] shortestPathDist is 99.2798668896577 This test took 1.823 seconds Setting up the environment. creating the graphs... operating on file: G_20000_160000_1.json reading from file...true shortestPathList is [0, 5855, 4630, 352, 10238, 11183, 4872, 6874, 9707, 7676, 4] shortestPathDist is 125.17665968464343 This test took 4.823 seconds Setting up the environment. creating the graphs... operating on file: G_30000_240000_1.json reading from file...true shortestPathList is [0, 27764, 5574, 25737, 16604, 18307, 15273, 19586, 12002, 14489, 14370, 12768, 3852, 4] shortestPathDist is 123.37112242332906 This test took 8.718 seconds

Clone this wiki locally