How to avoid overlapping edges in a bi directed graph with biograph?
22 次查看(过去 30 天)
显示 更早的评论
I'm using Matlab Bioinformatics Toolbox to draw a bidirected network graph with some nodes and some edges. Eg.: there is a link from node 1 to node 2 and there is a link from node 2 to node 1 with different weights. I want to specify my own coordinates to locate the nodes.
I tried in several ways but the problem is that I'm getting overlapped edges between the nodes. The toolbox initially sets the coordinates in a way the the graph is well drawn. But if a user wants to change the "Position" property of each node, then the resulting graph has overlapped edges.
Here is a simple code that produces overlapped links:
A = [0 20; 23 0]
bg=biograph(A, {'1' '2'},'Scale',1, 'LayoutScale', 1, 'ShowWeights','on')
h=view(bg)
set(h.Nodes(1),'Position',[10, 40])
set(h.Nodes(2),'Position',[70, 40])
dolayout(h, 'PathsOnly', true);

Is it a bug? How can I choose the location of the nodes without getting overlapped edges?
1 个评论
Niranjana K
2019-3-22
Yes you can probably do this and in the menubar only you have the option like refresh you can use to overcome overlapping. Thankyou
回答(2 个)
Paola Favaretto
2015-4-9
Hello,
Currently the algorithm used by dolayout to draw the edges with option 'PathsOnly' set to true works in a way that any two edges like the ones in your example collapse into a single bidirectional edge. The weights are correctly reported on the edges.
Unfortunately at the moment there is no easy workaround to get to the layout that you are envisioning. You could try to position the nodes in a way that prevents the edges from becoming one bidirectional edge: for example, you can position the nodes slightly off on the y axis, instead of aligning them.
-Paola
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Directed Graphs 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!