What would be the best algorithm to find localbridge(k) in Graph? A local bridge of degree k is an edge whose removal would enlarge the shortest distance between its two end-points to at least k.
Wikipedia: http://en.wikipedia.org/wiki/Bridge_(interpersonal)#Local_bridge
Run an all-shortest-path-costs algorithm, like the Floyd-Warshall algorithm, but where you use tuples (d1,d2)
for distances, instead of the typical real numbers d
:
d1
is the length of the shortest pathd2
is the length of the second shortest pathThis modification to the Floyd-Warshall algorithm should be straightforward.
When you are done running the all-shortest-path-costs algorithm, the localbridge(k)
edges are those edges e = {u, v}
such that the distance (1,d2)
between u
and v
satisfies d2 >= k
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With