#visualization #graphviz #dot
#визуализация #graphviz #точка
Вопрос:
Я рисую график на macbook с помощью graphviz dot, вот мой график simple.dot:
digraph {
node [shape=record, fontname="Courier New, Courier", fontsize=12]
graph [fontname="Courier New, Courier", fontsize=12]
edge [fontname="Courier New, Courier", fontsize=12]
node626 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell625">global.1</TD></TR>
<TR><TD PORT="cell627">symbol: name: integer_literal, type: ()=amp;>void, kind: Func</TD></TR>
<TR><TD PORT="cell633">symbol: name: string_literal, type: ()=amp;>void, kind: Func</TD></TR>
<TR><TD PORT="cell639">symbol: name: floating_point_literal, type: ()=amp;>void, kind: Func</TD></TR>
<TR><TD PORT="cell645">symbol: name: character_literal, type: ()=amp;>void, kind: Func</TD></TR>
<TR><TD PORT="cell651">typeSymbol: name: byte, kind: Plain</TD></TR>
<TR><TD PORT="cell652">typeSymbol: name: ubyte, kind: Plain</TD></TR>
<TR><TD PORT="cell653">typeSymbol: name: short, kind: Plain</TD></TR>
<TR><TD PORT="cell654">typeSymbol: name: ushort, kind: Plain</TD></TR>
<TR><TD PORT="cell655">typeSymbol: name: int, kind: Plain</TD></TR>
<TR><TD PORT="cell656">typeSymbol: name: uint, kind: Plain</TD></TR>
<TR><TD PORT="cell657">typeSymbol: name: long, kind: Plain</TD></TR>
<TR><TD PORT="cell658">typeSymbol: name: ulong, kind: Plain</TD></TR>
<TR><TD PORT="cell659">typeSymbol: name: float, kind: Plain</TD></TR>
<TR><TD PORT="cell660">typeSymbol: name: double, kind: Plain</TD></TR>
<TR><TD PORT="cell661">typeSymbol: name: char, kind: Plain</TD></TR>
<TR><TD PORT="cell662">typeSymbol: name: boolean, kind: Plain</TD></TR>
<TR><TD PORT="cell663">typeSymbol: name: void, kind: Plain</TD></TR></TABLE>>]
node629 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell628">integer_literal</TD></TR>
<TR><TD PORT="cell630">symbol: name: local.2, type: void, kind: Local</TD></TR></TABLE>>]
node632 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell631">local.2</TD></TR></TABLE>>]
node635 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell634">string_literal</TD></TR>
<TR><TD PORT="cell636">symbol: name: local.3, type: void, kind: Local</TD></TR></TABLE>>]
node638 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell637">local.3</TD></TR></TABLE>>]
node641 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell640">floating_point_literal</TD></TR>
<TR><TD PORT="cell642">symbol: name: local.4, type: void, kind: Local</TD></TR></TABLE>>]
node644 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell643">local.4</TD></TR></TABLE>>]
node647 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell646">character_literal</TD></TR>
<TR><TD PORT="cell648">symbol: name: local.5, type: void, kind: Local</TD></TR></TABLE>>]
node650 [label=<<TABLE BORDER="0" CELLSPACING="0" CELLBORDER="1">
<TR><TD PORT="cell649">local.5</TD></TR></TABLE>>]
node629:cell630 -> node632:cell631
node626:cell627 -> node629:cell628
node635:cell636 -> node638:cell637
node626:cell633 -> node635:cell634
node641:cell642 -> node644:cell643
node626:cell639 -> node641:cell640
node647:cell648 -> node650:cell649
node626:cell645 -> node647:cell646
}
Скомпилированный с dot -Tpng simple.dot -o simple.png
помощью, он дает мне:
Но PORT
, похоже, не работает, потому что ребра должны указывать на <TD>
другое <TD>
. А <TABLE BORDER>
также не работает, потому что граница моей таблицы выделена жирным шрифтом.
Пожалуйста, помогите.
Ответ №1:
Основная проблема в вашем файле — эта строка:
node [shape=record, fontname="Courier New, Courier", fontsize=12]
Что вам нужно, так это node [shape= none …]
node [shape=none, fontname="Courier New, Courier", fontsize=12]
Это устраняет проблемы с границей таблицы и портом. Если вы добавите точку компаса к некоторым ребрам, все станет еще лучше.
node626:cell627 -> node629:cell628:n