Borrar filtros
Borrar filtros

Network visualization distance between nodes

4 visualizaciones (últimos 30 días)
Felipe  Schuback
Felipe Schuback el 30 de Mayo de 2017
Comentada: Esperanza Linares Guerrero el 11 de Jun. de 2020
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 comentario
Seven Eden
Seven Eden el 14 de Ag. de 2019
Hi Felipe, did you found the answer? I'm struggling with the same.

Iniciar sesión para comentar.

Respuestas (1)

Steven Lord
Steven Lord el 14 de Ag. de 2019
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 comentarios
Seven Eden
Seven Eden el 15 de Ag. de 2019
Thanks!
Esperanza Linares Guerrero
Esperanza Linares Guerrero el 11 de Jun. de 2020
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?

Iniciar sesión para comentar.

Categorías

Más información sobre Graph and Network Algorithms en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by