Graphviz点文件疯狂边缘定位

时间:2019-01-13 14:41:18

标签: graphviz dot pygraphviz

我的点文件中的边缘位置有问题。 enter image description here

在点文件中,我使用了containsts = false从排名中排除了边缘m和l,并为其赋予了一些顶部和底部的端口(使用pygraphviz:headport='e', tailport='e'。 他们发疯了。我想将它们放在节点的右侧。

这是点文件:

strict digraph "" {
graph [bb="0,0,717.03,767.02",
    edges="{'arrowsize': '4.0'}",
    rankdir=LR,
    size="100,100",
];
cen0
   [height=0.5,
    label=a,
    rank=0,
    ];
3    [
    label=b,
    rank=1,
    ];
cen0 -> 3
   [label=z,
    pos=e];
0
   [label=c,
    rank=1,
    ];
cen0 -> 0
   [label=z,
    pos=e];
cor22
   [label=d,
    rank=2,
    ];
3 -> cor22
   [label=2,
    pos=e];
con23
   [label=e,
    rank=2,
    ];
3 -> con23
   [label=1,
    ];
cor2
   [label=g,
    rank=2,
    ];
0 -> cor2
   [label=4];
con4
   [label=h,
    rank=2,
    ];
0 -> con4
   [label=3];
1
   [label="Why I can't delete the attribute 'width' 
from this node?:
   Warning: Unable to reclaim box space in spline 
routing for edge \"con4\" ->\"con23\". Something is 
probably seriously wrong.
",
    rank=2,
    width=2.5731];
0 -> 1
   [label=k];
cor2:e -> cor22:e
   [constraint=false,
   rank=3
    label=l];
con4:e -> con23:e
   [constraint=false,
    rank=3
    label="Why this way?"];
}

当我删除最后一个“宽度”属性时,我还想知道为什么会出现该警告。 我期望如何才能获得优势?

2 个答案:

答案 0 :(得分:1)

这可能是带有很多“噪音”的自动生成的产品-我已经自由地几乎完全重新编写了代码,以使我可以更轻松地工作和测试,并专注于基本要素。您将重新添加对您来说很重要的内容,并找出其中的一些是否破坏了它。

经过大量的反复试验,我发现需要进行四项重大更改:

  • 四个第三级节点必须处于同一等级(rank = 3无济于事)
  • 它们需要通过不可见的边缘按期望的顺序连接
  • 这些节点之间的边缘需要保持正确的层次结构,箭头指向后方
  • xlabels而非labels需要用于边缘

所以这是我经过大量修改的代码

digraph so 
{
    rankdir = LR;
    // edge[ arrowsize = 4 ];           // you don't want that

    cen0[ label = "a" ];
    3   [ label = "b" ];
    0   [ label = "c" ];
    cen0 -> { 3 0 }[ label = "z" ];

    cor22[ label = "d" ];
    con23[ label = "e" ];
    3 -> cor22[ label = "2" ];
    3 -> con23[ label = "1" ];

    cor2[ label = "g" ];
    con4[ label = "h" ];
    1   [ label = "Why I can't delete the attribute 'width' from this node?:\nWarning: Unable to reclaim box space in spline routing for edge \"con4\" ->\"con23\".\nSomething is probably seriously wrong.\n---  Width attribute not present here!  ---" ];
    0 -> cor2[ label = "4"];
    0 -> con4[ label = "3" ];
    0 -> 1[ label = "k" ];

    {rank = same; cor22 con23 cor2 con4 1 }
    cor22 -> con23 -> cor2 -> con4[ style = invis ]
    cor22:e -> cor2:e[ dir = back, xlabel = "   l" ];
    con23:e -> con4:e[ dir = back, xlabel = "   Is this better?" ];
}

这是结果:

enter image description here

答案 1 :(得分:0)

缺少的属性是function getBrowserRTCConnectionObj () { var servers = {'iceServers': [{'url': 'stun:stun.services.mozilla.com'}, {'url': 'stun:stun.l.google.com:19302'}]}; if (window.mozRTCPeerConnection) { return new mozRTCPeerConnection(servers); } else if (window.webkitRTCPeerConnection) { return new webkitRTCPeerConnection(servers); } else if (window.msRTCPeerConnection) { return new msRTCPeerConnection(servers); } else { return new RTCPeerConnection(servers); } }; function getStream(){ //pytanie: nowy objekt zawsze przyjmuje nazwe connection bobConn = getBrowserRTCConnectionObj(); bobConn.onicecandidate = sentIceCandidates; bobConn.onaddstream = AddingStream; bobConn.setRemoteDescription( new RTCSessionDescription(TempDescriptions), function() { bobConn.createAnswer(gotDescription, displayError); //toggleVideo(); }, displayError); }; ,添加到我的graphviz代码中后得到: enter image description here