Σ f(u,   v) for all pair of u, v

Правка en1, от Confused101, 2017-04-27 07:34:44

I recently saw a problem in some online judge where I was given a tree and was asked the value of Σ f(u, v) for all pair of u, v where f is some function that takes two nodes u, v of a graph. for example f(u, v) can be any of these.

1) f(u, v) = distance between u, v in a weighted tree.
2) If every nodes have number written, f(u, v) can be median / mode / average/ sum of all numbers in path from u to v.
3) if every nodes have colors assigned f(u, v) can be number of distinct colors between path from u to v.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Confused101 2017-04-27 07:36:02 49
en1 Английский Confused101 2017-04-27 07:34:44 579 Initial revision (published)