绘图神器 —— Graphviz 绘制数据结构相关图形

复杂标签


绘图神器 —— Graphviz 绘制数据结构相关图形_第1张图片

digraph graphname{
    /* 把节点的形状设置为 record,默认的是圆角矩形 */
    node [shape = record];

    root [label = "left|middle|right"];
    left [label = "one|two"];
    right [label = "hello\nworld|{b|{c|d|e}|f}|g|h"];

    root -> left;
    root -> right;
}

二叉树


绘图神器 —— Graphviz 绘制数据结构相关图形_第2张图片

digraph graphname{
    label = "Binary Tree";
    node [shape = record];

    A [label = "<f0>|<f1>A|<f2>"];
    B [label = "<f0>|<f1>B|<f2>"];
    C [label = "<f0>|<f1>C|<f2>"];
    D [label = "<f0>|<f1>D|<f2>"];
    E [label = "<f0>|<f1>E|<f2>"];
    F [label = "<f0>|<f1>F|<f2>"];
    G [label = "<f0>|<f1>G|<f2>"];

    A:f0 -> B:f1;
    A:f2 -> C:f1;
    B:f0 -> D:f1;
    B:f2 -> E:f1;
    C:f0 -> F:f1;
    C:f2 -> G:f1;
}

References

[1] 程序员绘图利器 — Graphviz

你可能感兴趣的:(可视化)