码迷,mamicode.com
首页 > 其他好文 > 详细

gredit中使用graphviz

时间:2019-08-17 14:29:12      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:red   ever   ash   round   head   example   rap   mic   width   

官方文档

安装完graphviz后,文档在安装目录下,位置如下

E:\Gra2.38\share\graphviz\doc\html

中文乱码解决

将文件保存为utf-8编码

fontname="宋体";

技术图片

技术图片

dot语言语法

https://blog.csdn.net/jy692405180/article/details/52077979

https://blog.csdn.net/sd10086/article/details/52979462/

 demo

          有向图             

digraph graph1{            //digraph->  graph-- 
    label="this is a graph";
    a[shape="box"];
    b[shape="doublecircle"];
    i[style="filled"];
    ii[style="dotted",fontcolor="red"];
    iii[style="solid"];
    iiii[style="dashed"];
    iiiii[style="bold"];
    iiiiii[style="invis"];
    aa[style="filled",fillcolor="green"];//The premise of using "fillcolor" is that "style" is "filled"
    aaa[style="bold",color="blue"];
    bb[width=1,hight=20];
    
    edge [style="dotted"];        //node[] and edge[] are works for everything after that
    a->i;
    

    graph[bgcolor="lightskyblue"];
    rankdir="TB";            //LR RL TB BT
    //rotate=90;

    subgraph  cluster_sgh{            //subgraph顧﹍uster
    label="this is a subgraph";
    bgcolor=yellow;
    rankdir="LR";
    
    c[shape="egg",label="this is node c"];
    d[label="this is node d"];        
    }

    subgraph  cluster_sgh2{    
    fontname="FangSong";                //鐎涙ぞ缍
    label="input chinese";
    bgcolor=blue;
    e;f;
    e->f;        
    }

    subgraph  cluster_sgh3{    
    fontname="SimHei";                //姒涙垳缍
    label="youkan input chinese";
    bgcolor=red;
    g;h;
    h->h;        
    }

/*
table1 [label=<
<table>
    <tr>
        <td port="one">1</td>
        <td>2</td>
    </tr>
    <tr>
        <td>3</td>
        <td>4</td>
    </tr>
</table>
>];

*/

example [ shape = record, label = "{<head>cell1 | cell2 | cell3}" ];

node [shape=record];
edge [style="bold"];
table1 [label="{<head>cell1|cell2|a}"];
table2 [label="{<head>b|c|d|e}"];
table1:head->table2:head;

}

 

 技术图片

            无向图              

graph graph1{
    label="this is a graph";
    a;b;
    a--b;
}

 

技术图片

 

 

 

 

 

 

                  二叉树                  

digraph g {
    node [shape="record", height=.1];
    node0[label="<f0> |<f1> G|<f2>"];
    node1[label="<f0> |<f1> E|<f2>"];
    node2[label="<f0> |<f1> B|<f2>"];
    node0:f0 -> node1:f1;
    node0:f2 -> node2:f1;
}

 

技术图片

 

 

                 横竖排                   

digraph g{
    node[shape="record"];
    a[label="{a|b|c}"];    //vertical column
    b[label="<f0>a|<f1>b|<f2>c"];    //horizontal

}

 

技术图片

              时序图                    

digraph g {
    rankdir="LR";
    {
        rank="same";
        a0 -> a1 -> a2;
    }
    {
        rank="same";
        b0 -> b1 -> b2;
    }
    a1 -> b1;
}

 

技术图片

 

gredit中使用graphviz

标签:red   ever   ash   round   head   example   rap   mic   width   

原文地址:https://www.cnblogs.com/zhanjiahui/p/11368070.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!