How to avoid overlapping edges in a bi directed graph with biograph?

20 visualizaciones (últimos 30 días)
JQ
JQ el 8 de Abr. de 2015
Comentada: Niranjana K el 22 de Mzo. de 2019
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 comentario
Niranjana K
Niranjana K el 22 de Mzo. de 2019
Yes you can probably do this and in the menubar only you have the option like refresh you can use to overcome overlapping. Thankyou

Iniciar sesión para comentar.

Respuestas (2)

Paola Favaretto
Paola Favaretto el 9 de Abr. de 2015
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

JQ
JQ el 7 de Sept. de 2015
Thank you very much Paola for your kind answer. I'm very very sorry for my late answer. It's a pity that no workarounds exist at the moment. It should be not so difficult to implement a solution. The possibility to customize the graph would be very helpful. I hope that there will be some solutions very soon.

Categorías

Más información sobre Directed Graphs 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