Friday, 15 January 2021

find the most valuable vertex among all reachable vertices (really hard question)

I have a Directed Graph G=(V,E) that each vertex v has two properties:

  • r indicating the worthiness
  • m indicating the highest v''s r (where v' is a reachable vertex from v).

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