フィルターのクリア

Network visualization distance between nodes

4 ビュー (過去 30 日間)
Felipe  Schuback
Felipe Schuback 2017 年 5 月 30 日
Hi, I am working on a network visualization project for my university. This important point here is to actually show when nodes are far or close to each other. I want the plot to show how far or how close a node is from each other given the weights. I created a random network just to figure out the commands, as follows:
s = [1 1 1 2 1 2 5];
t = [2 3 5 4 6 7 8];
weights = [1 2 5 20 3 5 1];
names = {'A' 'B' 'C' 'D' 'E' 'F' 'G' 'H'};
G = graph(s,t,weights,names);
plot(G);
When I run this, no matter the numbers I put in the weights array, the image itself when I plot does not change. How can I manage to actually show in the plot that point A for example is closer to point B then from point F. The illustrative aspect is very very important.
Thank you! Felipe.
  1 件のコメント
Seven Eden
Seven Eden 2019 年 8 月 14 日
Hi Felipe, did you found the answer? I'm struggling with the same.

サインインしてコメントする。

回答 (1 件)

Steven Lord
Steven Lord 2019 年 8 月 14 日
If you're using release R2018a or later, specify the 'WeightEffect' name-value pair when you plot or layout your graph or digraph plot. See the "Graph Layout Based on Edge Weight" example on the layout documentation page which shows how 'WeightEffect', 'direct' affects the graph layout.
  2 件のコメント
Seven Eden
Seven Eden 2019 年 8 月 15 日
Thanks!
Esperanza Linares Guerrero
Esperanza Linares Guerrero 2020 年 6 月 11 日
I tried it, but my nodes did not chage. Here is what I did:
A=[0,100,50;100,0,100;50,100,0]
node_names = {'A','B','C'};
G = graph(A,node_names);
p=plot(G,'Layout','force','EdgeLabel',G.Edges.Weight);
layout(p,'force','WeightEffect','direct')
Any idea why?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by