【问题标题】:Showing Arbitrary Graph Nodes and Edges for a Network in GraphViz在 GraphViz 中显示网络的任意图节点和边
【发布时间】:2012-08-21 08:38:16
【问题描述】:

我想绘制一个网络,它是一个完全连接的有向图,具有任意数量的节点和边,如图所示。 用 GraphViz 绘制这个的简单方法是什么?

【问题讨论】:

    标签: graph graphviz graph-visualization


    【解决方案1】:

    graphviz 画廊有一个非常相似的entry,带有精美的图形:就像在生成脚本中用您自己的名称替换名称start 等一样简单。将其提供给dot 程序。

    digraph G {bgcolor="red:cyan" gradientangle=0
    
        subgraph cluster_0 {
            style=filled;
            color=lightgrey;
            fillcolor="blue:yellow";
            gradientangle=90;
            node [fillcolor="yellow:green" style=filled gradientangle=270] a0;
            node [fillcolor="green:red"] a1;
            node [fillcolor="red:cyan"] a2;
            node [fillcolor="cyan:blue"] a3;
    
            a0 -> a1 -> a2 -> a3;
            label = "process #1";
        }
    
        subgraph cluster_1 {
            node [fillcolor="yellow:magenta" 
                 style=filled gradientangle=270] b0;
            node [fillcolor="magenta:cyan"] b1;
            node [fillcolor="cyan:red"] b2;
            node [fillcolor="red:blue"] b3;
    
            b0 -> b1 -> b2 -> b3;
            label = "process #2";
            color=blue
            fillcolor="blue:yellow";
            style=filled;
            gradientangle=90;
        }
        start -> a0;
        start -> b0;
        a1 -> b3;
        b2 -> a3;
        a3 -> a0;
        a3 -> end;
        b3 -> end;
    
        start [shape=Mdiamond ,
            fillcolor="yellow:brown",
            gradientangle=90,
            style=radial];
        end [shape=Msquare,
            fillcolor="orange:blue",
            style=radial,
            gradientangle=90];
    }
    

    【讨论】:

    • 是的,我看到了,问题是我正在寻找类似图片中的东西,带有点 (.),节点标记为从 1 到 n。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-07-11
    • 2012-10-03
    • 2018-08-25
    • 1970-01-01
    • 2017-10-14
    • 2021-08-23
    • 1970-01-01
    相关资源
    最近更新 更多