Browse Source

that was not enough

tarfeef101 6 năm trước cách đây
mục cha
commit
4303404907
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      a3/router.py

+ 2 - 2
a3/router.py

@@ -146,7 +146,7 @@ class graph:
     def rebuild(this):
         print("Before building")
         print(this.alist)
-        this.sssp = [(inf, 0)] * 5
+        this.sssp = [(inf, rid - 1)] * 5
         this.sssp[rid - 1] = (0, rid - 1)
         
         curnode = rid - 1
@@ -166,7 +166,7 @@ class graph:
                     continue
                 result = min((this.sssp[curnode][0] + this.alist[curnode][i]), this.sssp[i][0])
                 if (result != this.sssp[i][0]):
-                    this.sssp[i] = (result, curnode)
+                    this.sssp[i] = (result, this.sssp[curnode][1])
                 else:
                     this.sssp[i] = (result, this.sssp[i][1])