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

bidirectional digraphsdigraphsgraph theory

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

Best Answer

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);