Class: YaGraph::SubGraph

Inherits:
Graph show all
Defined in:
lib/yagraphlib.rb

Constant Summary

Constants inherited from Graph

Graph::RANKDIR_LR

Instance Method Summary collapse

Methods inherited from Graph

#edge?, #edges, #initial_nodes, #nodes, #rankdir, #subgraph, #terminal_nodes

Methods inherited from Element

#random_id, #uid

Constructor Details

#initializeSubGraph

Returns a new instance of SubGraph.



100
101
102
# File 'lib/yagraphlib.rb', line 100

def initialize()
  super()
end

Instance Method Details

#is_clusterObject



104
# File 'lib/yagraphlib.rb', line 104

def is_cluster() false end

#labelObject



114
# File 'lib/yagraphlib.rb', line 114

def label() nil end

#to_graphviz(out) ⇒ Object



106
107
108
109
110
111
112
# File 'lib/yagraphlib.rb', line 106

def to_graphviz(out)
  out.puts("  subgraph #{if is_cluster() then "cluster_" else "" end}#{uid()} {")
  if label() then out.puts("    label=\"#{label()}\"") end
  @nodes.each {|k, n| out.write("  "); n.to_graphviz(out) }
  @edges.each {|k, e| out.write("  "); e.to_graphviz(out) }
  out.puts("  }")
end