graph - How to compute the average(or sum) of node values in a network? -


consider network(graph) of n nodes , each of them holding value, how design program/algorithm (for each node) allows each node compute average(or sum) of node values in network?

assumptions are:

  1. direct communication between nodes constrained graph topology, not complete graph. other assumptions, if necessary algorithm, allowable. weakest 1 assume there's loop in graph contains nodes.
  2. n finite.
  3. n suffiently large such can't store values , compute average (or sum). same reason, can't "remember" value you've received (thus can't redistributing values you've received , add you've not seen buffer , result).

(the tags may not right since don't know field kind of problems in, if it's kind of general problem.)

that interesting question, here assumptions i've made, before present partial solution:

  1. the graph connected (in case of directed graph, connected)
  2. the nodes communicate direct neighbours
  3. it possible hold , send sum of numbers, means sum either won't exceed long or have data structure sufficiently large, won't exceed

i'd go depth first search. node n0 initiate algorithm , send it's value + count first neighbour (n0.1). n0.1 add it's own value + count , forward message next neighbour (n0.1.1). in case message comes either n0 or n0.1 forward neighbour of theirs. (n0.2 or n0.1.2).

the problem know, when terminate algorithm. preferably want terminate you've reached nodes, , afterwards broadcast final message. in case know how many nodes there in graph, keep on forwarding next node, until every node reached eventually. last node know had been reached (it can compare count variable number of nodes in graph) , broadcast message.

if don't know how many nodes there are, , it's , undirected graph, depth first implementation in graph. means, if n0.1 gets message else n0.1.1 bounce message back, can't send messages parent when performing depth first search. if directed graph , don't know number of nodes, either come mathematical model prove when algorithm has finished, or learn number of nodes.

i've found paper here, proposing gossip based algorithm count number of nodes in dynamic network: https://gnunet.org/sites/default/files/gossipico.pdf maybe help. maybe can use sum nodes.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -