在Matlab中求解图中节点的影响 [英] Solve for influence of nodes in graph in Matlab
本文介绍了在Matlab中求解图中节点的影响的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个有5个节点的定向未加权图:x1到x5。边缘是:
x1-> x3
pre>
x2-> x1
x2-> x5
x3-> x2
x3-> x4
x4-> x5
x5-> x2
我想解决这个对应于图的方程组:
x1 = alpha * x2
x2 = alpha *(x3 + x5)
x3 = alpha * x1
x4 = alpha * x3
x5 = alpha *(x2 + x4)
x1 + x2 + x3 + x4 + x5 = 1
如何设置在Matlab中解决这些方程并解决?我想要x1到x5这些方程的值。
解决方案以下是适用于我的解决方案: p>
syms abcde alpha
S = solve(-a + alpha * b == 0,-b + alpha * c + alpha * d == 0,alpha * ac == 0,alpha * cd == 0,...
alpha * de == 0,a + b + c + d + e == 1);
S = [S.a S.b S.c S.d S.e S.alpha]
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.
解决方案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]
这篇关于在Matlab中求解图中节点的影响的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文