phmarek / fsvs

Full System Versioning System
GNU General Public License v3.0
6 stars 3 forks source link

Incorrect dot code for newer versions of dot #4

Closed albert-github closed 1 year ago

albert-github commented 1 year ago

In the newer versions of dot (at least as of version 2.50) the following definitions:

https://github.com/phmarek/fsvs/blob/1df0f3747eae1d59c2b0d840c1a21ac2afbc46fc/src/hash_ops.c#L79-L145

give warnings like:

Warning: flat edge between adjacent nodes one of which has a record shape - replace records with HTML-like labels
  Edge key -> 1
Error: lost key 1 edge
Warning: flat edge between adjacent nodes one of which has a record shape - replace records with HTML-like labels
  Edge key -> 1
Error: lost key 1 edge
Warning: flat edge between adjacent nodes one of which has a record shape - replace records with HTML-like labels
  Edge 1 -> key_C
Error: lost key_A key_B edge
Error: lost 1 key_C edge
Warning: flat edge between adjacent nodes one of which has a record shape - replace records with HTML-like labels
  Edge 1 -> key_C
Error: lost key_A key_B edge
Error: lost 1 key_C edge

this can be overcome by replacing the mentioned code, as indicated, with:

 * \dot
 * digraph {
 *   splines = false;
 *   node [shape=plaintext];
 *   {
 *     rank=same;
 *     C0 [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD PORT="p">0</TD><TD port="v">value2</TD></TR></TABLE>>];
 *     C1 [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD PORT="p">1</TD><TD port="v">value1</TD></TR></TABLE>>];
 *   }
 *   {
 *     rank=same;
 *     key [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD port="p">key</TD></TR></TABLE>>];
 *     1 [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD port="p">1</TD></TR></TABLE>>];
 *   }
 *   key:p -> C1:v;
 *   1:p -> C0:v;
 *
 *   edge [style=dotted];
 *   edge [arrowhead=none, arrowtail=normal];
 *   1:p -> C1:p;
 *
 *   edge [style=invis, weight=20];
 *   key -> 1;
 * }
 * \enddot
 * After several insertions, the situation might be like this:
 * \dot
 * digraph {
 *   splines = false;
 *   node [shape=plaintext];
 *   {
 *     rank=same;
 *     Ca [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD PORT="p">0</TD></TR><TR><TD>value_A</TD></TR></TABLE>>];
 *     Cb [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD PORT="p">0</TD></TR><TR><TD>value_B2</TD></TR></TABLE>>];
 *     Cb2 [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD PORT="p">1</TD></TR><TR><TD>value_B1</TD></TR></TABLE>>];
 *     Cc3 [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD PORT="p">3</TD></TR><TR><TD>value_C3</TD></TR></TABLE>>];
 *     Cc2 [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD PORT="p">2</TD></TR><TR><TD>value_C2</TD></TR></TABLE>>];
 *     Cc [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD PORT="p">0</TD></TR><TR><TD>value_C1</TD></TR></TABLE>>];
 *   }
 *   {
 *     rank=same;
 *     key_A [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD PORT="p">Key_A</TD></TR></TABLE>>];
 *     key_B [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD PORT="p">Key_B</TD></TR></TABLE>>];
 *     key_C [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD PORT="p">Key_C</TD></TR></TABLE>>];
 *     1 [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD PORT="p">1</TD></TR></TABLE>>];
 *     2 [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD PORT="p">2</TD></TR></TABLE>>];
 *     3 [label=<<TABLE BORDER="0" CELLBORDER="1" CELLSPACING="0"><TR><TD PORT="p">3</TD></TR></TABLE>>];
 *   }
 *
 *   "key_A":p -> Ca:p;
 *
 *   "key_B":p -> Cb2:p;
 *   "1":p -> Cb:p;
 *
 *   "key_C":p -> Cc3:p;
 *   "2":p -> Cc:p;
 *   "3":p -> Cc2:p;
 *
 *   edge [style=dotted];
 *   edge [arrowhead=none, arrowtail=normal];
 *   1:p -> Cb2:p;
 *   3:p -> Cc3:p;
 *   2:p -> Cc2:p;
 *
 *   edge [style=invis, weight=20];
 *   key_A -> key_B;
 *   1 -> key_C;
 * }
 * \enddot
phmarek commented 1 year ago

Thanks for the heads-up!

Would you please be so kind as to prepare a pull request, too?

albert-github commented 1 year ago

I've just pushed a proposed patch, pull request #5

albert-github commented 1 year ago

Code has been integrated in master on GitHub