对于下面给定的矩阵,如何将其表示为无向加权图G(V,E,W),其中V是顶点集合,E是边集,W是权重集。
4 2 3 1 4
2 2 3 1 4
2 3 3 1 4
1 2 3 1 4
4 2 3 1 5
我尝试的源代码:
%table2 is given matrix
bg = biograph(table2,[],'ShowArrows','off','ShowWeights','on');
h = view(bg);
这是用矩阵表示无向加权图的正确方式吗?我得到了两个相同的顶点之间有2条边的结果,就像这样:
![enter image description here](https://istack.dev59.com/AwAsO.webp)
![enter image description here](https://istack.dev59.com/eTiJH.webp)
4 2 3 1 4
2 2 3 1 4
2 3 3 1 4
1 2 3 1 4
4 2 3 1 5
4 1 3 2 4
1 1 2 3 4
3 1 3 2 4
2 1 3 2 4
4 1 3 2 5
我走的路是对还是错?请给我建议。
'ShowWeights','off'
? - Stewie Griffin