I am trying to find a solution for the next problem with help of Java. I have a graph, this is a good example of how it could look:

There is its notation:
[{A = {C = 0.7}, {D = 0.3}},
{C = {out = 0.2}, {F = 0.8}},
{D = {C = 0.1}, {F = 0.2}, {G = 0.3}, {E = 0.4}},
{S = {A = 0.4},{B = 0.6}},
{E = {G = 0.3},{out = 0.7}},
{G = {B = 0.2}{out = 0.8}},
…
S – is a start node (S = 1), out – is a way out of the graph.
I want to trace the graph and know how much percentage each node has.
In instance, A = 0.4*S (S = 1), C = 0.7A + 0.1D , D = 0.3A + 0.7B
I thought it is possible to do it with recursion(DFS for directed graphs, in particular Tarjan’s alg.), but while there are cycles I do not think it helps. Another solution is to solve a system of linear equations.
I do not know what is better that would work, and maybe there are some solutions exist for this kind of tasks.
This example is just an example, but I should consider that I have like appr. 2000 nodes (and who know how many cycles).
How would you do it?
Solving linear equations seems to be a very good approach.
You can try to use Gaussian Elimination. I am pretty sure you can just find already written Java code to do it for you, on the web.