dot

Forcing “main line” nodes into a straight line in Graphviz (or alternatives)

与世无争的帅哥 提交于 2019-11-28 04:43:49
I'm trying to use Graphviz dot (but am willing to use something else) to generate a graph with a long "main line" of nodes, and many small branches. I'd like the main line to be straight from left to right, with the small branches above or below it. However, Graphviz "balances" the two branches, so I end up with a crooked graph. To illustrate, here's a sketch similar to what I currently get: And this is what I actually want: Is there any way to force or encourage Graphviz to generate a graph like the second one? I may be able to use "dummy" second branches to have it do a 3-way layout, and

Reading DOT files in javascript/d3

放肆的年华 提交于 2019-11-28 03:29:08
Is there a standard way to read and parse DOT graph files in javascript, ideally in way that will work nicely in d3? Currently, the only thing I can think of doing is reading plain text and doing my own parsing. Hopefully this'd be reinventing the wheel though. d3.text("graph.dot", function(error, dotGraph) { .... )}; Richard Neish To get Graphviz DOT files rendered in Javascript, combine the graphlib-dot and dagre-d3 libraries. The graphlibDot.parse() method takes a graph or digraph definition in DOT syntax and produces a graph object. The dagreD3.Renderer.run() method can then output this

How can I control within level node order in graphviz's dot?

懵懂的女人 提交于 2019-11-27 22:15:16
I have a graph that has a tree as its backbone. So I have, for example a node A with children B, C, and D. Assuming the graph is being drawn top-down, A will be on one level, then B, C, and D. I would like to force graphviz to lay them out in B, C, D order within their rank. Is this possible? If so, how? If there are only A, B, C, and D, I can get this effect by just putting B, C, and D in that order in the input dot file. But if there are other edges out of B, C, and/or D, sometimes the order gets scrambled. That's what I would like to avoid. This can be achieved with "invisible" edges as

决策树的可视化输出

僤鯓⒐⒋嵵緔 提交于 2019-11-27 21:19:03
前面的博客里有提到决策树,我们也了解了决策树的构建过程,如果可以可视化决策树,把决策树打印出来,对我们理解决策树的构建会有很大的帮助。这篇文章中,我们就来看下如何可视化输出一棵决策树。 一、安装相应的插件 我们需要安装Graphviz和pygraphviz, 教程 ,这个教程里有详细的安装过程,这里就不赘述了。 二、运行实例 我们依然以iris数据集为例,打印输出决策树看下效果。 #coding=utf-8 import numpy as np import pandas as pd import pydotplus def lrisTrain (): #预处理-引入鸢尾数据: from sklearn.datasets import load_iris iris = load_iris() from sklearn.cross_validation import train_test_split # 把数据分为测试数据和验证数据 train_data,test_data,train_target,test_target=train_test_split(iris.data,iris.target,test_size= 0.2,random_state= 1) #Model(建模)-引入决策树 from sklearn import tree #建立一个分类器 clf = tree

GraphViz Node Placement and Rankdir

白昼怎懂夜的黑 提交于 2019-11-27 17:30:56
I'm having very good luck with graphviz and have been able to make nearly every graph that I need. I'm trying to duplicate this: http://en.wikipedia.org/wiki/File:ICS_Structure.PNG as faithfully as I can. The bottom part of that graph all flows top to bottom and I've got that working fine. What I have not been able to do is place the first 3 children right below "Incident Commander". They branch left and right. Plus note how the edges are shared in the top 8 nodes. Is that possible with dot? I can deal with everything else but not those top nodes. Can someone give me a clue to solve this? Two

有意思的的粒子效果

ぃ、小莉子 提交于 2019-11-27 14:56:27
<canvas>有意思的粒子效果 这两天突然有点儿空闲下来,闲着无聊东搜搜西看看,发现一款用canvas写的 粒子效果 挺棒的。在阅读了大神的源码以后自己参照着封装了一个构造函数,用来以后项目可能出现的使用,详情源码可以移步 这里 。 先晾一个 demo 给大家看看吧,因为小球数量比较多,因此无可避免的存在一些卡顿,当然也因为自己当前技术还比较粗糙,后期有机会会进行优化的。 使用说明可以参考git上的 README ,因此这儿做一些代码分析吧: var canvas = document .querySelector (element) ; this .canvas = canvas ; this .ctx = canvas .getContext ( "2d" ) ; 声明canvas,并获得上下文。 // defaultOpts为默认属性,当开发人员没有填写时默认使用的参数 var defaultOpts = { total: 300 , // 粒子总数 color: "#AAAAAA" , // 粒子和连接线的颜色 size: 2 , // 粒子大小 width: this .canvas.parentNode.clientWidth, // canvas的宽度 height: this .canvas.parentNode.clientHeight // canvas的高度

subgraph cluster ranking in dot

跟風遠走 提交于 2019-11-27 13:57:52
问题 I'm trying to use graphviz on media wiki as a documentation tool for software. First, I documented some class relationships which worked well. Everything was ranked vertically as expected. But, then, some of our modules are dlls, which I wanted to seperate into a box. When I added the nodes to a cluster, they got edged, but clusters seem to have a LR ranking rule. Or being added to a cluster broke the TB ranking of the nodes as the cluster now appears on the side of the graph. This graph

How to place edge labels ON edge in graphviz

让人想犯罪 __ 提交于 2019-11-27 13:53:14
By default in Graphviz, edge labels are placed just to the right of the edge. I'm looking for a way to place the labels OVER the edge, centred on the edge. (It'll still be readable because I'm changing the colour of the edge). Any ideas? Paweł Polewicz If this was headlabel or taillabel, you could try setting labeldistance to zero to force the label to be drawn on the edge, but as I understand, you are referring to edge label (the one on the middle of the edge). Documentation quite clearly states that labeldistance only affects headlabel and taillabel labels, but you can try your luck. One

How can I dump an abstract syntax tree generated by gcc into a .dot file?

痴心易碎 提交于 2019-11-27 13:07:33
问题 I think the question's title is self explanatory, I want to dump an abstract syntax tree generated by gcc into a .dot file (Those files generated by Graphviz) because then I want to view it in a .png file or similar. Is there any way I can do that? Thanks in advance :) 回答1: There are two methods, both including two steps Using GCC internal vcg support Compile your code (say test.c) with vcg dumps gcc -fdump-tree-vcg -g test.c Use any third party tool to get dot output from vcg graph-easy test

关于宏病毒的原理及其防范技术

て烟熏妆下的殇ゞ 提交于 2019-11-27 12:48:13
1、 宏病毒的基本概念 如果某个文档中包含了宏病毒,我们称此文档感染了宏病毒,如果woro系统中的模板包含了宏病毒,我们称word系统感染了宏病毒。 2、 宏病毒来源 虽然OFFICE97/Word97无法扫描软盘、硬盘或网络驱动器上的宏病毒.但当打开一个含有可能携带病毒的宏的文档时,它能够显示宏警告信息,并且在2013年后的杀毒软件己支持宏病毒扫描。 这样就可选择打开文档时是否要包含宏,如果希望文档包含要用到的宏(例如,单位所用的定货窗体),打开文档时就包含宏 如果您并不希望在文档中包含宏,或者不了解文档的确切来源。例如,文档是作为电子邮件的附件收到的,或是来自网络或不安全的intemet节点,在这种情况下,为了防止可能发生的病毒传染,打开文档过程中出现宏警告提示时最好选择“取消宏” OFFICE97软件包安装后,系统中包含有关于宏病毒防护的选项,其默认状态是允许“宏病毒保护”复选相。如果愿意,您可以终止系统对文档宏病毒的检查当Word显示宏病毒警告信息时,清除“在打开带有宏或自定义内容的文档时提问”复选框,或者关闭宏检查:单击“工具”菜单中的“选项”命令,再单击“常规”选项卡,然后清除“宏病毒保护”复选框。 不过建议您不要取消宏病毒防护功能,否则您会失去这道防护宏病毒的天然屏障。 上世纪90年代的宏病毒主要感染文件有word、Excel的文档,并且会驻留在Normal