Sha256: b9a4e125a4e530cd5d051d3656546a2f72de98cb97ee38b3e660e502bd71ccad

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

#!/usr/bin/ruby -w

# digraph G {
#
#   subgraph cluster_0 {
#     style=filled;
#     color=lightgrey;
#     node [style=filled,color=white];
#     a0 -> a1 -> a2 -> a3;
#     label = "process #1";
#   }
#
#   subgraph cluster_1 {
#     node [style=filled];
#     b0 -> b1 -> b2 -> b3;
#     label = "process #2";
#     color=blue
#   }
#   start -> a0;
#   start -> b0;
#   a1 -> b3;
#   b2 -> a3;
#   a3 -> a0;
#   a3 -> end;
#   b3 -> end;
#
#   start [shape=Mdiamond];
#   end [shape=Msquare];
# }

require "graph"

digraph do
  # composite styles
  leaf_node = white + filled

  subgraph "cluster_0" do
    label "process #1"
    graph_attribs << filled << lightgray
    node_attribs  << leaf_node

    edge "a0", "a1", "a2", "a3"
  end

  subgraph "cluster_1" do
    label "process #2"
    graph_attribs << blue
    node_attribs  << filled

    edge "b0", "b1", "b2", "b3"
  end

  edge "start", "a0"
  edge "start", "b0"
  edge "a1", "b3"
  edge "b2", "a3"
  edge "a3", "a0"
  edge "a3", "end"
  edge "b3", "end"

  mdiamond << node("start")
  msquare  << node("end")

  save "cluster", "png"
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
graph-2.2.0 gallery/cluster.rb
graph-2.1.0 gallery/cluster.rb
graph-2.0.1 gallery/cluster.rb
graph-2.0.0 gallery/cluster.rb