How do I configure the ports of record-based nodes in GraphViz?

I feed this simple script input by defining node-based entries for point-building SVGs (the SVG part doesn't really matter):

graph mygraph{
  node [shape=record, fontsize=10, fontname=Arial];
  rankdir=TB;
  ranksep=0.5;
  rank=max;
  splines=true;
  overlap=false;
  mindist=0.2;
  "d1" [style=solid, label="{\N|{<0> 0|<1> 1}}"];
  "d2" [style=solid, label="{\N|{<0> 0|<1> 1|<2> 2|<3> 3}}"];
  "d1":0 -- "d2":0[color=blue, penwidth=3, tooltip="d1:0 -- d2:0", URL="#"];
}

This gives a graph in which ports 0 of d1and port 0 d2are connected by a blue spline:

dot result

Fine

Now I need to colorize the ports . For example: port 1 of d2should be green, and port 2 of d2should be orange. Or something.

How do I achieve this?


Edit 1: The solid frame around the nodes is important. I need it hard for some nodes, broken for others.

+4
source share
1

HTML- . :

graph mygraph{
  node [shape=record, fontsize=10, fontname=Arial];
  rankdir=TB;
  ranksep=0.5;
  rank=max;
  splines=true;
  overlap=false;
  mindist=0.2;
  d1 [shape=none, margin=0, label=<
    <table border="0" cellborder="1" cellspacing="0" cellpadding="4">
        <tr><td colspan="2">d1</td></tr>
        <tr><td port="0">0</td><td>1</td></tr>
    </table>>];
  d2 [shape=none, margin=0, label=<
    <table border="0" cellborder="1" cellspacing="0" cellpadding="4">
        <tr><td colspan="4">d2</td></tr>
        <tr><td port="0">0</td><td bgcolor="green">1</td><td bgcolor="orange">2</td><td>3</td></tr>
    </table>>];
  d1:0 -- d2:0[color=blue, penwidth=3, tooltip="d1:0 -- d2:0", URL="#"];
}

:

enter image description here

port .

+6

Source: https://habr.com/ru/post/1528097/


All Articles