Skip to content

Instantly share code, notes, and snippets.

@SudhakarReddyPeddinti
Created November 26, 2016 21:07
Show Gist options
  • Save SudhakarReddyPeddinti/ef3fb7200622b7877f8d1e0664e95acd to your computer and use it in GitHub Desktop.
Save SudhakarReddyPeddinti/ef3fb7200622b7877f8d1e0664e95acd to your computer and use it in GitHub Desktop.
Python program memory profiler
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
137 13.9 MiB 0.0 MiB @profile(stream=fp)
138 def floydWarshall(EdgeGraph):
139 # Initialize the edge weights to distances.
140 13.9 MiB 0.0 MiB for u in range(n):
141 13.9 MiB 0.0 MiB for v in range(n):
142 13.9 MiB 0.0 MiB distance[u][v] = EdgeGraph[u][v]
143 13.9 MiB 0.0 MiB nextVertex[u][v] = v
144
145 13.9 MiB 0.0 MiB for k in range(n):
146 13.9 MiB 0.0 MiB for i in range(n):
147 13.9 MiB 0.0 MiB for j in range(n):
148 13.9 MiB 0.0 MiB if distance[i][k] + distance[k][j] < distance[i][j]:
149 13.9 MiB 0.0 MiB distance[i][j] = round(distance[i][k] + distance[k][j],2)
150 13.9 MiB 0.0 MiB nextVertex[i][j] = nextVertex[i][k]
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
89 13.9 MiB 0.0 MiB @profile(stream=fp)
90 def printShortestDistance(distGraph):
91 13.9 MiB 0.0 MiB print('\n'.join([''.join(['{:8}'.format('{:>8}'.format("na") if item==INF else '{:>8}'.format("INF") if item==NoPath else item) for item in row])
92 13.9 MiB 0.0 MiB for row in distGraph]))
93 13.9 MiB 0.0 MiB print("\n")
94 13.9 MiB 0.0 MiB print("\n")
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 path_list.append(int(predecessor))
113 hopCount[u][v] = hopCount[u][v]+1
114 origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 path_list.append(int(predecessor))
113 hopCount[u][v] = hopCount[u][v]+1
114 origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 path_list.append(int(predecessor))
113 hopCount[u][v] = hopCount[u][v]+1
114 origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 path_list.append(int(predecessor))
113 hopCount[u][v] = hopCount[u][v]+1
114 origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 path_list.append(int(predecessor))
113 hopCount[u][v] = hopCount[u][v]+1
114 origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 13.9 MiB 0.0 MiB path_list.append(int(predecessor))
113 13.9 MiB 0.0 MiB hopCount[u][v] = hopCount[u][v]+1
114 13.9 MiB 0.0 MiB origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
97 13.9 MiB 0.0 MiB @profile(stream=fp)
98 def get_path(origin, dest):
99 """
100 Reconstruct shortest path from each of u to v using the predecessor matrix passed as input
101 This method is not recursive to avoid reach of call stack limit when input is a large matrix
102 """
103 13.9 MiB 0.0 MiB u = origin - 1
104 13.9 MiB 0.0 MiB v = dest - 1
105
106 13.9 MiB 0.0 MiB path_list = [origin]
107 13.9 MiB 0.0 MiB while 1:
108 13.9 MiB 0.0 MiB predecessor = nextVertex[origin - 1][dest - 1] + 1
109 13.9 MiB 0.0 MiB if predecessor == origin:
110 13.9 MiB 0.0 MiB path_array[u][v] = path_list
111 13.9 MiB 0.0 MiB return map(str, path_list)
112 path_list.append(int(predecessor))
113 hopCount[u][v] = hopCount[u][v]+1
114 origin = predecessor
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
117 13.9 MiB 0.0 MiB @profile(stream=fp)
118 def printShortestPath():
119 13.9 MiB 0.0 MiB print("Floyd Warshall Graph Paths")
120 13.9 MiB 0.0 MiB for u, i in enumerate(range(0, n), 1):
121 13.9 MiB 0.0 MiB for v, j in enumerate(range(0, n), 1):
122 13.9 MiB 0.0 MiB print(('(')+','.join(get_path(u,v))+')', end=" ")
123 13.9 MiB 0.0 MiB print("\n")
124 13.9 MiB 0.0 MiB print("\n")
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
127 13.9 MiB 0.0 MiB @profile(stream=fp)
128 def printHopCount():
129 13.9 MiB 0.0 MiB print("Hop count:")
130 13.9 MiB 0.0 MiB for u in range(n):
131 13.9 MiB 0.0 MiB for v in range(n):
132 13.9 MiB 0.0 MiB print(hopCount[u][v], end=" ")
133 13.9 MiB 0.0 MiB print(" ")
134 13.9 MiB 0.0 MiB print("\n")
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
69 13.9 MiB 0.0 MiB @profile(stream=fp)
70 def calculate_load(edge_matrix, flow_matrix, output_matrix):
71 13.9 MiB 0.0 MiB for u in range(n):
72 13.9 MiB 0.0 MiB for v in range(n):
73 13.9 MiB 0.0 MiB if(edge_matrix[u][v] == INF):
74 13.9 MiB 0.0 MiB output_matrix[u][v] = INF
75 13.9 MiB 0.0 MiB if(1==1):
76 13.9 MiB 0.0 MiB route = path_array[u][v]
77 13.9 MiB 0.0 MiB directions = zip(route[0::1], route[1::1])
78 13.9 MiB 0.0 MiB for i in directions:
79 13.9 MiB 0.0 MiB output_matrix[i[0]-1][i[1]-1] += flow_matrix[u][v]
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
89 13.9 MiB 0.0 MiB @profile(stream=fp)
90 def printShortestDistance(distGraph):
91 13.9 MiB 0.0 MiB print('\n'.join([''.join(['{:8}'.format('{:>8}'.format("na") if item==INF else '{:>8}'.format("INF") if item==NoPath else item) for item in row])
92 13.9 MiB 0.0 MiB for row in distGraph]))
93 13.9 MiB 0.0 MiB print("\n")
94 13.9 MiB 0.0 MiB print("\n")
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j]=0
49 elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 if (congestion>0):
54 actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j]=INF
51 else:
52 congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 if (congestion>0):
54 actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j]=INF
51 else:
52 congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 if (congestion>0):
54 actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j]=INF
51 else:
52 congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 if (congestion>0):
54 actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j]=0
49 elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 if (congestion>0):
54 actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j]=INF
51 else:
52 congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 if (congestion>0):
54 actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j]=0
49 elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 if (congestion>0):
54 actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j]=0
49 elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 if (congestion>0):
54 actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j]=INF
51 else:
52 congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 if (congestion>0):
54 actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j]=INF
51 else:
52 congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 if (congestion>0):
54 actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j]=0
49 elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 if (congestion>0):
54 actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j]=INF
51 else:
52 congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 if (congestion>0):
54 actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j]=INF
51 else:
52 congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 if (congestion>0):
54 actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 13.9 MiB 0.0 MiB congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 13.9 MiB 0.0 MiB if (congestion>0):
54 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 actual_edge_delay_matrix[i][j]=0
49 13.9 MiB 0.0 MiB elif(edge_weights[i][j]==INF):
50 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j]=INF
51 else:
52 congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 if (congestion>0):
54 actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
45 13.9 MiB 0.0 MiB @profile(stream=fp)
46 def congestion_formula(i,j, c):
47 13.9 MiB 0.0 MiB if(i==j):
48 13.9 MiB 0.0 MiB actual_edge_delay_matrix[i][j]=0
49 elif(edge_weights[i][j]==INF):
50 actual_edge_delay_matrix[i][j]=INF
51 else:
52 congestion = ((c+1)/(c+1 - load_matrix[i][j]))*edge_weights[i][j]
53 if (congestion>0):
54 actual_edge_delay_matrix[i][j] = round(congestion, 2)
55 else:
56 actual_edge_delay_matrix[i][j] = NoPath
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
61 13.9 MiB 0.0 MiB @profile(stream=fp)
62 def actual_edge_delay(capacity):
63 13.9 MiB 0.0 MiB for u in range(n):
64 13.9 MiB 0.0 MiB for v in range(n):
65 13.9 MiB 0.0 MiB congestion_formula(u,v,capacity[u][v])
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
89 13.9 MiB 0.0 MiB @profile(stream=fp)
90 def printShortestDistance(distGraph):
91 13.9 MiB 0.0 MiB print('\n'.join([''.join(['{:8}'.format('{:>8}'.format("na") if item==INF else '{:>8}'.format("INF") if item==NoPath else item) for item in row])
92 13.9 MiB 0.0 MiB for row in distGraph]))
93 13.9 MiB 0.0 MiB print("\n")
94 13.9 MiB 0.0 MiB print("\n")
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
30 13.9 MiB 0.0 MiB @profile(stream=fp)
31 def actual_path_delay(shortest_path, actual_edge_delay, output):
32 13.9 MiB 0.0 MiB for u in range(n):
33 13.9 MiB 0.0 MiB for v in range(n):
34 13.9 MiB 0.0 MiB route = shortest_path[u][v]
35 13.9 MiB 0.0 MiB street_map = zip(route[0::1], route[1::1])
36 13.9 MiB 0.0 MiB for i in street_map:
37 13.9 MiB 0.0 MiB if (actual_edge_delay[i[0] - 1][i[1] - 1] == NoPath):
38 output[u][v] = NoPath
39 break
40 else:
41 13.9 MiB 0.0 MiB output[u][v] += actual_edge_delay[i[0]-1][i[1]-1]
42 13.9 MiB 0.0 MiB output[u][v] = round(output[u][v],2)
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
89 13.9 MiB 0.0 MiB @profile(stream=fp)
90 def printShortestDistance(distGraph):
91 13.9 MiB 0.0 MiB print('\n'.join([''.join(['{:8}'.format('{:>8}'.format("na") if item==INF else '{:>8}'.format("INF") if item==NoPath else item) for item in row])
92 13.9 MiB 0.0 MiB for row in distGraph]))
93 13.9 MiB 0.0 MiB print("\n")
94 13.9 MiB 0.0 MiB print("\n")
Filename: /Users/sudhakar/Documents/Gits/Shortest_Path_In_Congestion/Shortest_Path_In_Congestion/CongestionHandler.py
Line # Mem usage Increment Line Contents
================================================
19 13.9 MiB 0.0 MiB @profile(stream=fp)
20 def print_edge_values(edge_matrix, actual_edge_matrix, path):
21 13.9 MiB 0.0 MiB edges = zip(path[0::1],path[1::1])
22 13.9 MiB 0.0 MiB print(" Edge_path, Predicted_edge_length, Actual_edge_length")
23 13.9 MiB 0.0 MiB i = 0
24 13.9 MiB 0.0 MiB for street in edges:
25 13.9 MiB 0.0 MiB print('{:>8} {:>15} {:>20}'.format(str(street), str(edge_matrix[street[0]-1][street[1]-1]), str("INF" if actual_edge_matrix[street[0]-1][street[1]-1] == NoPath else actual_edge_matrix[street[0]-1][street[1]-1])))
26 13.9 MiB 0.0 MiB i=i+1
27 13.9 MiB 0.0 MiB print("Hop count is ",i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment