antitypical / TesseractCore

Tesseract’s evaluation and type system.
MIT License
30 stars 1 forks source link

Export edges to DOT with headlabel/taillabel attributes for the indices #41

Closed robrix closed 9 years ago

robrix commented 9 years ago

We currently export e.g.:

digraph tesseract {
    "if" -> "result";
    "x" -> "if";
    "0" -> "lessThan";
    "x" -> "lessThan";
    "unaryMinus" -> "if";
    "lessThan" -> "if";
    "x" -> "unaryMinus";
}

which graphviz renders as:

screen shot 2015-02-12 at 19 21 34

if has three in-edges, but they’re unlabelled and only ordered by convention. We’d get a better result if we labelled the head and tail of the edges.

We should also use sametail and samehead. Here’s an example of abs gussied up a little:

digraph tesseract {
    "if" -> "result";
    "x" -> "if" [headlabel=0,sametail=0,labeldistance=2];
    "0" -> "lessThan" [headlabel=0,labeldistance=2];
    "x" -> "lessThan" [headlabel=1,sametail=0,labeldistance=2];
    "unaryMinus" -> "if" [headlabel=1,labeldistance=2];
    "lessThan" -> "if" [headlabel=2,labeldistance=2];
    "x" -> "unaryMinus" [sametail=0,labeldistance=2];
}

screen shot 2015-02-12 at 19 28 59

robrix commented 9 years ago

Went for headlabel/sametail in #51.