问题
I have a directed, unweighted graph with 5 nodes: x1 through x5. The edges are:
x1->x3
x2->x1
x2->x5
x3->x2
x3->x4
x4->x5
x5->x2
I want to solve this set of equations corresponding to the graph:
x1 = alpha * x2
x2 = alpha * (x3 + x5)
x3 = alpha * x1
x4 = alpha * x3
x5 = alpha * (x2 + x4)
x1 + x2 + x3 + x4 + x5 = 1
How can I set up these equations and solve in Matlab? I want the values of x1 through x5 for which the equations hold.
回答1:
Here is the solution that worked for me:
syms a b c d e alpha
S = solve(-a+alpha*b==0, -b+alpha*c+alpha*d==0, alpha*a-c==0, alpha*c-d==0, ...
alpha*d-e==0, a+b+c+d+e==1);
S = [S.a S.b S.c S.d S.e S.alpha]
来源:https://stackoverflow.com/questions/16255827/solve-for-influence-of-nodes-in-graph-in-matlab