. O (n ^ 2).
EDIT . , j , , . n ^ 2, node n * n n ^ 2. - , n ^ 2 Dijkstra O (| E | + | V | log | V |). , -O?
EDIT EDIT It seems like I don't remember big-O correctly. The iteration over the matrix will be n ^ 2, and Dijkstra at each will be an additional waybill. I don’t see how to do this in the general case, without figuring out exactly which W 'paths are included ... this, apparently, implies that each pair should be checked. Thus, you need to either update each pair at a constant time or not check the significant parts of the array.
source
share