How to convert 2-way edges in digraphs to straight single line edges?

3 visualizzazioni (ultimi 30 giorni)
In small network, two-way looping links are easy to understand (left in the figure), but in bigger networks, two-way loops make the network really unpleasant (right in the figure). Is there any way I can draw the two directional digraphs with straight lines? (with maybe the directions shown by arrows on the links (just like it is shown in one-directional digraphs) but in two directions.
I posted this question before but got no answers.. hoping for some this time... Thanks

Risposta accettata

Achter
Achter il 7 Ago 2016
Well.. there is no direct way with which MATLAB can convert the circular two-way links to a single straight line. But deleting the backward link from each OD pair and plotting the graph as simple graph will do the trick.. for that I used this code: ----->
input1 = xlsread('neu.xlsx');
input2 = xlsread('neu_xy.xlsx');
x = input2(:,2)';
y = input2(:,3)';
a = input1(:,[1 2])';
j=0;
count = 0;
while j < size(a,2);
j = j+1;
for i = 1:size(a,2)-1
if flipud(a(:,i)) == a(:,j)
a(:,j) =[];
count = count + 1;
end
end
end
G = graph(a(1,:),a(2,:));
h = plot(G,'XData',x,'YData',y);
highlight (h,1:16, 'NodeColor','k','MarkerSize',6);
  1 Commento
Bezalem Eshetu Yirdaw
Bezalem Eshetu Yirdaw il 6 Ott 2022
My apologies am not here to answer your question, rather, could you provide me the code to use different colors for the edges please. Thanks.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Networks in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by