This preview shows page 1. Sign up to view the full content.
Unformatted text preview: with a smaller v .d value, then we are done and v .d = ( s,v ) . If at least one vertex was updated, then a negative weight cycle must exist and the v .d values are not necessarily correct. (Optional: Find the negative weight cycle and mark all the vertices on it and reachable from it to have v .d = ) Initialization takes O ( V ) time, relaxation takes O ( E ( V1)) = O ( V E ) time, and detecting negative cycles takes O ( E ) time. Overall, the runtime of BellmanFord is O ( V E ) . There is a O ( V E ) algorithm that corrects v .d in the case of negative weight cycles (see lecture notes), so even with the optional step, the runtime remains O ( V E ) ....
View
Full
Document
This note was uploaded on 11/11/2011 for the course MATH 180 taught by Professor Byrns during the Spring '11 term at Montgomery College.
 Spring '11
 byrns
 Math

Click to edit the document details