java - graph algorithm for (economic) share graph -


hi graph theory experts :)

i'm facing algorithmic problem cannot solve myself.

i have find indirect shares each company each other in directed graph containing direct shares (see image simple example).

i have start directed graph nodes companies , edges direct shares between these companies. algorithm has append indirect shares between nodes edges (this includes adding new edges graph during algorithm).

an indirect share defined product of intermediate direct shares. if there nodes a, b , c in graph, there 1 indirect share, 1 c.

indirect(a, c) = 100% * 80% = 1 * 0.8 = 0.8 = 80%

now need algorithm computes shares whole graph. there no specific starting point in graph, , may contain variety of circles of each size (in example there 1 "direct" circle between c , d) , multiple paths between pair of nodes (like paths c e).

it helpful if me out pseudo code or description of possible algorithm. searched algorithms in graph theory books , on internet, can find standard algorithms finding shortest path, paths, or visiting nodes of graph. cannot find mechanism calculate kind of mathematical combination of graph edge weights.

example share graph

let operationalise ownership looking @ happens if given company receives $1, , money received passed on shareholders according ownership. reckon proportion of ownership final proportion of money received when passing of money around has died down.

it easiest account first of total money received each company, , give set of linear equations solution tell total amount of money received every company when $1 sent in first instance company a.

suppose example , b own 1/2 of each other. = 1 + b/2 , b = a/2, total amount of money received a, , b total amount of money received b - because $1 , 1/2 of whatever b sees, , b 1/2 of sees. solves = 1 + a/4 or = 4/3 , b = 2/3. if follow each step of distribution receives 1 , sends 1/2 b, sends 1/4 a, sends 1/8 b sends 1/16 a... gets 1 + 1/4 + 1/16 + ... = 4/3.

so sees total of 4/3 , b sees total of 2/3 - , b have pass on 1/2 of receive, ends 2/3 , b ends 1/3, makes sense - incoming $1 accounted for.

if take distribution of money indicative of ownership, owns 2/3 of itself, , b owns other 1/3.


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -