Question: I NEED THE COMPLEXITY FOR EACH LINE PLEASE ( you can write it as a comment in the code ) /// def DinicMaxflow(self, s, t):

I NEED THE COMPLEXITY FOR EACH LINE PLEASE ( you can write it as a comment in the code )

/// def DinicMaxflow(self, s, t):

if s == t: return -1

total = 0

while self.BFS(s, t) == True:

start = [0 for i in range(self.V+1)] while True: flow = self.sendFlow(s, float('inf'), t, start) if not flow: break total += flow return total # c = [[0 for i in range(5000)] for j in range(5000)] g = Graph(5000)

def loadGraph(): my_file = open(r"C:\Users\azhar\OneDrive\Documents\algorithms\project\datat.txt", "r") for number in my_file: nums=number.split("\t") row=int(nums[0])-1 col=int(nums[1].strip())-1 g.addEdge(row, col, float(nums[2].strip()))

loadGraph() start3 = time.perf_counter() f = g.DinicMaxflow(0, 90) print("Maximum flow: ", f) end3 = time.perf_counter() #o(1) print("time: ",end3 - start3) # o(1)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!