I have a Directed Graph G=(V,E) that each vertex v has two properties:
rindicating the worthinessmindicating the highestv''sr(wherev'is a reachable vertex fromv).
I need to find ms for all vertices in O(|V|+|E|) time.
For example,
Initial G
A(r = 1, m = 1) → B(r = 3, m = 3) ← C(r = 2, m = 2)
↓
D(r = 4, m = 4)
has to be
A(r = 1, m = 4) → B(r = 3, m = 3) ← C(r = 2, m = 3)
↓
D(r = 4, m = 4)
I searched SO and found some at Here, but one of the answer does not bound in time and another answer is very badly explained. Is there any simpler idea here?
from find the most valuable vertex among all reachable vertices (really hard question)
No comments:
Post a Comment