资源描述:
《GraphViz常用属性学习笔记.docx》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、GraphViz常用属性InportantAttributesGraphAttributes·label="MyGraph";Labelagraphitself·rankdir=LR;LaythegraphoutfromLefttoRight,insteadofToptoBottom·{rank=same;a,b,c}Groupnodestogetheratthesamelevelofagraph·splines="line";Forceedgestobestraight,nocurvesora
2、ngles·K=0.6;Usedtoinfluencethe'spring'usedinthelayout,Canbeusedtopushnodesfurtherapart,whichisespeciallyusefulfortwopiandsfdplayoutsVertexAttributes·[label="SomeLabel"]LabelstheVertex·[color="red"]ColorstheVertex·[fillcolor="blue"]FillstheVertexwitht
3、hespecifiedcolourEdgeAttributes·[label="SomeLabel"]LabelstheEdge(UsefulforWeights)·[color="red"]ColorstheVertex(UsefulforPaths)·[Thickness=2.0]·[penwidth=2.0]Adjuststhethicknessoftheedgeline,VeryusefulforPathsEdgesmayalsohavea weight attribute,define
4、das [weight=0.5] forexample,butnotethatthisdoesn'tdisplaytheweightdirectly,Itinsteadactsasahinttothegraphlayouttogivethisedgeamoredirectrouting.Graph的定义graph{node1--node2;node3--node2;}digraph{node1->node2;node3->node2;}Vertices的定义可以先声明其属性,再使用digraph
5、{someVertex[label="AComplicatedLabel"];someVertex->node2;node2->node3;}定义和使用线条,定义colour/thickness,labeldigraph{node1->node2[color="red"label=”edge1”];}在Graph中定义edge和note的全局变量,以及支持中文输入。DigraphG{Fontname=”FangSong”Fontcolor=”red”Label=”中文图片”;Edge[fontn
6、ame=“FangSong”]Node[shape=”box”fontname=”FangSong”size=”10,10”];A[label=”节点A”];B[label=”节点B”];C[label=”节点C”];使用rank定义排列位置{rank=same;A,B}A->B->C;vim中编辑graphviz文件并生成图片发表于3个月前(2016-01-3111:30) 阅读(77)
7、 评论(3) 2人收藏此文章, 我要收藏赞04月23日,武汉源创会火热报名中,期待您的参与>>>>>
8、 摘要 vim中编辑graphviz文件并自定义函数调用dot生成图片写一个zbjxb.vim文件,并将该文件放到vim的plugin目录。linux下一般是/usr/share/vim/vim74/plugin/.linux下代码为:functionDot(format)letfmt=a:formatletcmd='dot'letopt='-T'.fmt.'-o'letcurrfile=expand('%:p')letoutfile=currfile.'.'.fmtsilentexecute
9、'!start'.cmd.'"'.currfile.'"'.opt.'"'.outfile.'"'endfunctionwindows下代码为:functionDot(format)letfmt=a:formatletcmd='"C:UsersGuestDownloadsProgramFiles(x86)Graphviz2.30bindot.exe"'letopt='-T'.fmt.'-o'letcurrfile=expand('%:p')letoutfile=currfile.'