I have pipeline directed graph which has one source and several sinks
getWeights = Function[{g},
res = {};
s = Flatten[{#1} & @@@ g, 1];
For[i = 1, i <= Length[s], i++,
AppendTo[res, 1/Count[Flatten[{#1} & @@@ g, 1], s[[i]]]];];
res
];
egdes = {0 -> 1, 0 -> 2, 0 -> 3, 1 -> 4, 1 -> 5, 1 -> 6, 3 -> 6,
3 -> 7 , 2 -> 5, 2 -> 6, 4 -> 8, 5 -> 8, 5 -> 9, 6 -> 9, 7 -> 9,
5 -> 10, 7 -> 10};
wghts = getWeights[egdes]
Graph[egdes, EdgeWeight -> wghts,
VertexLabels -> Placed["Name", Center], VertexSize -> Medium,
EdgeLabels -> Table[egdes[[i]] -> wghts[[i]], {i, Length[egdes]}]]
sinks = Complement[DeleteDuplicates[Flatten[{#2} & @@@ egdes, 1]],
DeleteDuplicates[Flatten[{#1} & @@@ egdes, 1]]]
sources= Complement[DeleteDuplicates[Flatten[{#1} & @@@ egdes, 1]],
DeleteDuplicates[Flatten[{#2} & @@@ egdes, 1]]]
Now I would like to calculate the the flow in sinks assuming the flow at source is equal to 1. I did it by finding all paths from source to sink and then summing the products of all edges weight in the path for all paths. My code is rather ugly and slow for large graphs so I do not put it here. I hope that someone could help me to find more elegant and fast decision. For the case in the figure there are three sinks {5,6,7} I found flows {3/8,1/4,3/8}
egdes
(also note the typo). $\endgroup$