Parent

GraphViz

Constants for ruby-graphviz

GraphViz::Constants::FORMATS: the possible output formats

"bmp", "canon", "dot", "xdot", "cmap", "dia", "eps",
"fig", "gd", "gd2", "gif", "gtk", "hpgl", "ico", "imap",
"cmapx", "imap_np", "cmapx_np", "ismap", "jpeg", "jpg",
"jpe", "mif", "mp", "pcl", "pdf", "pic", "plain",
"plain-ext", "png", "ps", "ps2", "svg", "svgz", "tga",
"tiff", "tif", "vml", "vmlz", "vrml", "vtx", "wbmp",
"xlib", "none"

GraphViz::Constants::PROGRAMS: The possible programs

"dot", "neato", "twopi", "fdp", "circo"

GraphViz::Constants::GRAPHTYPE The possible types of graph

"digraph", "graph"

The single letter codes used in constructors map as follows:

G => The root graph, with GRAPHATTRS
E => Edge, with EDGESATTRS
N => Node, with NODESATTRS
S => subgraph
C => cluster

>> x = "hellont\l"world""

> "hellont\l"world""

>> puts x.inspect.gsub( "\\", "\" ) "hellontl"world""

OR

>> x = 'hellontl"world"'

> "hello\n\t\l"world""

>> puts x.inspect.gsub( "\\", "\" ) "hellontl"world""


spliteType or point

spline ( ';' spline )* where spline = (endp)? (startp)? point (triple)+ and triple = point point point and endp = "e,%f,%f" and startp = "s,%f,%f"

If a spline has points p1 p2 p3 ... pn, (n = 1 (mod 3)), the points correspond to the control points of a B-spline from p1 to pn. If startp is given, it touches one node of the edge, and the arrowhead goes from p1 to startp. If startp is not given, p1 touches a node. Similarly for pn and endp.


TODO: Remove


bool

For the bool type,

Example

graph[:center] = "true"

or

graph[:center] = true

or

graph[:center] = 23

Attributes

edge[RW]

This accessor allow you to set global edges attributes

edge_attrs[RW]

This accessor allow you to set global edges attributes

graph[RW]

This accessor allow you to set global graph attributes

graph_attrs[RW]

This accessor allow you to set global graph attributes

node[RW]

This accessor allow you to set global nodes attributes

node_attrs[RW]

This accessor allow you to set global nodes attributes

Public Class Methods

default( hOpts ) click to toggle source

Change default options (:use, :path, :errors and :output)

# File lib/graphviz.rb, line 708
def self.default( hOpts )
  hOpts.each do |k, v|
    case k.to_s
      when "use"
        @@prog = v
      when "path"
        @@path = v.split( "," ).map{ |x| x.strip }
      when "errors"
        @@errors = v
      when "extlibs"
        @@extlibs = v.split( "," ).map{ |x| x.strip }
      else
        warn "Invalid option #{k}!"
    end
  end
end
libxslt_transform(xml, xsl) click to toggle source
# File lib/graphviz/nothugly.rb, line 54
def self.libxslt_transform(xml, xsl)
   LibXML::XML.default_load_external_dtd = false
   LibXML::XML.default_substitute_entities = false

   stylesheet_doc = LibXML::XML::Document.file(xsl)
   stylesheet = LibXSLT::XSLT::Stylesheet.new(stylesheet_doc)
   xml_doc = LibXML::XML::Document.file(xml)
   stylesheet.apply(xml_doc).to_s
end
new( xGraphName, hOpts = {}, &block ) click to toggle source

Create a new graph object

Options :

  • :output : Output format (GraphViz::Constants::FORMATS) (default : dot)

  • :file : Output file name (default : nil)

  • :use : Program to use (GraphViz::Constants::PROGRAMS) (default : dot)

  • :path : Program PATH

  • :parent : Parent graph (default : nil)

  • :type : Graph type (GraphViz::Constants::GRAPHTYPE) (default : digraph)

  • :errors : DOT error level (default 1)

    • 0 = Error + Warning

    • 1 = Error

    • 2 = none

# File lib/graphviz.rb, line 808
def initialize( xGraphName, hOpts = {}, &block )
  @filename = nil
  @name     = xGraphName.to_s
  @format   = @@format
  @prog     = @@prog
  @path     = @@path
  @errors   = @@errors
  @extlibs  = @@extlibs
  @output   = {}
  @nothugly = false
  @strict   = false

  @scale        = nil
  @inverty      = nil
  @no_layout    = nil
  @reduce_graph = nil
  @Lg           = nil
  @LO           = nil
  @Ln           = nil
  @LU           = nil
  @LC           = nil
  @LT           = nil

  @elements_order = GraphViz::Elements::new()

  @oParentGraph = nil
  @oGraphType   = "digraph"

  @hoNodes  = Hash::new()
  @loEdges  = Array::new()
  @hoGraphs = Hash::new()

  @node  = GraphViz::Attrs::new( self, "node",  NODESATTRS  )
  @edge  = GraphViz::Attrs::new( self, "edge",  EDGESATTRS  )
  @graph = GraphViz::Attrs::new( self, "graph", GRAPHSATTRS )

  hOpts.each do |xKey, xValue|
    case xKey.to_s
      when "use"
        if PROGRAMS.index( xValue.to_s ).nil?
          raise ArgumentError, "can't use '#{xValue}'"
        end
        @prog = xValue.to_s
      when "parent"
        @oParentGraph = xValue
      when "type"
        if GRAPHTYPE.index( xValue.to_s ).nil?
          raise ArgumentError, "graph type '#{xValue}' unknow"
        end
        @oGraphType = xValue.to_s
      when "path"
        @path = xValue.split( "," ).map{ |x| x.strip }
      when "strict"
        @strict = (xValue ? true : false)
      when "errors"
        @errors = xValue
      when "extlibs"
        @extlibs = xValue.split( "," ).map{ |x| x.strip }
      else
        self[xKey.to_s] = xValue.to_s
    end
  end

  yield( self ) if( block )
end
nothugly( file, save = true ) click to toggle source

Transform to pretty up the SVG output

For more information, see www.hokstad.com/making-graphviz-output-pretty-with-xsl.html and www.hokstad.com/making-graphviz-output-pretty-with-xsl-updated.html

You can use the :nothugly option to GraphViz#output :

graph.output( :svg => "myGraph.svg", :nothugly => true )

Or directly on an SVG output graph :

GraphViz.nothugly( "myGraph.svg" )
# File lib/graphviz/nothugly.rb, line 33
def self.nothugly( file, save = true )
  xsl = File.join( File.dirname(File.expand_path(__FILE__)), "nothugly", "nothugly.xsl" )
  out = self.send(XSLT_METHOD, file, xsl)

  if save
    fname = File.join( File.dirname(File.expand_path(file)), File.basename(file))
    File.open( fname, "w" ) { |io|
      io.print out
    }
  else
    return out
  end
end
options( hOpts ) click to toggle source
# File lib/graphviz.rb, line 725
def self.options( hOpts )
  GraphViz::default( hOpts )
end
parse( xFile, hOpts = {}, &block ) click to toggle source

Create a new graph from a GraphViz File

Options :

  • :output : Output format (GraphViz::Constants::FORMATS) (default : dot)

  • :file : Output file name (default : none)

  • :use : Program to use (GraphViz::Constants::PROGRAMS) (default : dot)

  • :path : Program PATH

# File lib/graphviz.rb, line 739
def self.parse( xFile, hOpts = {}, &block )
  graph = Dot2Ruby::new( hOpts[:path], nil, nil ).eval( xFile )
  yield( graph ) if( block and graph )
  return graph
end
parse_string( str, hOpts = {}, &block ) click to toggle source

Create a new graph from a GraphViz File

Options :

  • :output : Output format (GraphViz::Constants::FORMATS) (default : dot)

  • :file : Output file name (default : none)

  • :use : Program to use (GraphViz::Constants::PROGRAMS) (default : dot)

  • :path : Program PATH

# File lib/graphviz.rb, line 753
def self.parse_string( str, hOpts = {}, &block )
  graph = Dot2Ruby::new( hOpts[:path], nil, nil ).eval_string( str )
  yield( graph ) if( block and graph )
  return graph
end
xml_xslt_transform(xml, xsl) click to toggle source
# File lib/graphviz/nothugly.rb, line 47
def self.xml_xslt_transform(xml, xsl)
  xslt = XML::XSLT.new()
  xslt.xml = xml
  xslt.xsl = xsl
  xslt.serve()
end

Public Instance Methods

-( oNode ) click to toggle source
Alias for: <<
<<( oNode ) click to toggle source

Create an edge between the current cluster and the node or cluster oNode

# File lib/graphviz.rb, line 654
def <<( oNode )
  raise( ArgumentError, "Edge between root graph and node or cluster not allowed!" ) if self.pg.nil?

  if( oNode.class == Array )
    oNode.each do |no|
      self << no
    end
  else
    return GraphViz::commonGraph( oNode, self ).add_edges( self, oNode )
  end
end
Also aliased as: >, -, >>
>( oNode ) click to toggle source
Alias for: <<
>>( oNode ) click to toggle source
Alias for: <<
[]( xAttrName ) click to toggle source

Get the value of the graph attribute xAttrName

# File lib/graphviz.rb, line 387
def []( xAttrName )
  if Hash === xAttrName
    xAttrName.each do |key, value|
      self[key] = value
    end
  else
    return( @graph[xAttrName].clone )
  end
end
[]=( xAttrName, xValue ) click to toggle source

Set value xValue to the graph attribute xAttrName

# File lib/graphviz.rb, line 379
def []=( xAttrName, xValue )
  xValue = xValue.to_s if xValue.class == Symbol
  @graph[xAttrName] = xValue
end
add(h) click to toggle source

Add nodes and edges defined by a Hash

# File lib/graphviz.rb, line 325
def add(h)
  if h.kind_of? Hash
    h.each do |node, data|
      add_hash_edge(node, data)
    end
  end
end
add_edge( oNodeOne, oNodeTwo, hOpts = {} ) click to toggle source
# File lib/graphviz.rb, line 184
def add_edge( oNodeOne, oNodeTwo, hOpts = {} )
  if oNodeTwo.kind_of? Array or oNodeOne.kind_of? Array 
    raise ArgumentError, "use `add_edges' to add several edges at the same time"
  end
  add_edges(oNodeOne, oNodeTwo, hOpts)
end
add_edges( node_one, node_two, options = {} ) click to toggle source

Create a new edge

In:

  • node_one : First node (or node list)

  • node_two : Second Node (or node list)

  • options : Edge attributes

# File lib/graphviz.rb, line 197
def add_edges( node_one, node_two, options = {} )

  if( node_one.class == Array )
    node_one.each do |no|
      add_edges( no, node_two, options )
    end
  else
    if( node_two.class == Array )
      node_two.each do |nt|
        add_edges( node_one, nt, options )
      end
    else
      edge = GraphViz::Edge::new( node_one, node_two, self )
      edge.index = @elements_order.size_of( "edge" )

      options.each do |xKey, xValue|
        edge[xKey.to_s] = xValue
      end

      @elements_order.push( {
        "type" => "edge",
        "value" => edge
      } )
      @loEdges.push( edge )

      return( edge )
    end
  end
end
add_graph( xGraphName = nil, hOpts = {}, &block ) click to toggle source

Create a new graph

In:

  • xGraphName : Graph name

  • hOpts : Graph attributes

# File lib/graphviz.rb, line 262
def add_graph( xGraphName = nil, hOpts = {}, &block )
   if xGraphName.kind_of?(GraphViz)
      xGraphID = xGraphName.id
      @hoGraphs[xGraphID] = xGraphName.clone
      @hoGraphs[xGraphID].type = @oGraphType
      @hoGraphs[xGraphID].pg = self
      xGraphName = xGraphID
   else
      if xGraphName.kind_of?(Hash)
         hOpts = xGraphName
         xGraphName = nil
      end

      if xGraphName.nil?
         xGraphID = String.random(11)
         xGraphName = ""
      else
         xGraphID = xGraphName
      end

      @hoGraphs[xGraphID] = GraphViz::new( xGraphName, {:parent => self, :type => @oGraphType}, &block )

      hOpts.each do |xKey, xValue|
         @hoGraphs[xGraphID][xKey.to_s] = xValue
      end
   end

   @elements_order.push( {
      "type" => "graph",
      "name" => xGraphName,
      "value" => @hoGraphs[xGraphID]
   } )

   return( @hoGraphs[xGraphID] )
end
Also aliased as: subgraph
add_node( xNodeName, hOpts = {} ) click to toggle source
# File lib/graphviz.rb, line 87
def add_node( xNodeName, hOpts = {} )
  if xNodeName.kind_of? Array
    raise ArgumentError, "use `add_nodes' to add several nodes at the same time"
  end
  return add_nodes(xNodeName, hOpts)
end
add_nodes(node_name, options = {}) click to toggle source

Create a new node

In:

  • xNodeName : Name of the new node

  • hOpts : Node attributes

Return the GraphViz::Node object created

# File lib/graphviz.rb, line 101
def add_nodes(node_name, options = {})
   if node_name.kind_of? Array
      node_name.each { |n| add_nodes(n, options.clone) }
   else
      node = @hoNodes[node_name]

      if node.nil?
         @hoNodes[node_name] = GraphViz::Node::new( node_name, self )
         @hoNodes[node_name].index = @elements_order.size_of( "node" )

         unless options.keys.include?(:label) or options.keys.include?("label")
            options[:label] = node_name
         end

         @elements_order.push( {
            "type" => "node",
            "name" => node_name,
            "value" => @hoNodes[node_name]
         } )

         node = @hoNodes[node_name]
      end

      options.each do |xKey, xValue|
         @hoNodes[node_name][xKey.to_s] = xValue
      end

      return node
   end
end
append_attributes_and_types(script) click to toggle source
# File lib/graphviz.rb, line 610
def append_attributes_and_types(script)
  script_data = DOTScriptData.new

  @elements_order.each { |kElement|
    is_new_type = script_data.type != kElement["type"]
    if is_new_type 
      unless script_data.type.nil? or script_data.empty?
        script << script_data
      end
      script_data = DOTScriptData.new(kElement["type"])
    end

    # Modified by Brandon Coleman verify value is NOT NULL
    kElement["value"] or raise ArgumentError, "#{kElement["name"]} is nil!"

    case kElement["type"]
      when "graph_attr", "node_attr", "edge_attr"
        script_data.add_attribute(kElement["name"], kElement["value"].to_gv)
      when "node", "graph"
        script << kElement["value"].output()
      when "edge"
        script << "  " + kElement["value"].output( @oGraphType )
      else
        raise ArgumentError,
          "Don't know what to do with element type '#{kElement['type']}'"
    end
  }
end
complete() click to toggle source

Return a new completed graph

# File lib/graphviz.rb, line 760
def complete
  GraphViz.parse_string( root_graph.output( :dot => String ) )
end
complete!() click to toggle source

Complete the current graph

# File lib/graphviz.rb, line 765
def complete!
  # TODO: Keep options
  complete
end
directed?() click to toggle source

Return true if the graph is directed.

# File lib/graphviz.rb, line 771
def directed?
  not((/digraph/ =~ "bla digraph bla").nil?)
end
each_attribut(&b) click to toggle source
# File lib/graphviz.rb, line 406
def each_attribut(&b)
   warn "`GraphViz#each_attribut` is deprecated, please use `GraphViz#each_attribute`"
   each_attribute(&b)
end
each_attribute(&b) click to toggle source

Calls block once for each attribute of the graph, passing the name and value to the block as a two-element array.

# File lib/graphviz.rb, line 401
def each_attribute(&b)
  @graph.each do |k,v|
    yield(k,v)
  end
end
each_edge( &block ) click to toggle source

Allow you to traverse edges

# File lib/graphviz.rb, line 230
def each_edge( &block )
  if block_given?
    @loEdges.each do |edge|
      yield(edge)
    end
  else
    return @loEdges
  end
end
each_graph( &block ) click to toggle source

Allow you to traverse graphs

# File lib/graphviz.rb, line 312
def each_graph( &block )
  if block_given?
    @hoGraphs.each do |name, graph|
      yield( name, graph )
    end
  else
    return @hoGraphs
  end
end
each_node( &block ) click to toggle source

Allow you to traverse nodes

# File lib/graphviz.rb, line 169
def each_node( &block )
  if block_given?
    @hoNodes.each do |name, node|
      yield( name, node )
    end
  else
    return( @hoNodes )
  end
end
edge_count() click to toggle source

Get the number of edges

# File lib/graphviz.rb, line 243
def edge_count
  @loEdges.size
end
find_node(name) click to toggle source

Returns the first node found in the entire graph, starting from the root graph

# File lib/graphviz.rb, line 142
def find_node(name)
   root = root_graph
   return root.search_node(name)
end
get_edge_at_index( index ) click to toggle source

Return the edge object for the given index

# File lib/graphviz.rb, line 250
def get_edge_at_index( index )
  element = @elements_order[index, "edge"]
  (element.nil?) ? nil : element["value"]
end
get_graph( xGraphName, &block ) click to toggle source

Return the graph object for the given name (or nil)

# File lib/graphviz.rb, line 301
def get_graph( xGraphName, &block )
  graph = @hoGraphs[xGraphName] || nil

  yield( graph ) if( block and graph )

  return graph
end
get_node( xNodeName, &block ) click to toggle source

Return the node object for the given name (or nil) in the current graph

# File lib/graphviz.rb, line 133
def get_node( xNodeName, &block )
  node = @hoNodes[xNodeName] || nil

  yield( node ) if( block and node )

  return node
end
get_node_at_index( index ) click to toggle source

Return the node object for the given index

# File lib/graphviz.rb, line 161
def get_node_at_index( index )
  element = @elements_order[index, "node"]
  (element.nil?) ? nil : element["value"]
end
graph_count() click to toggle source

Get the number of graphs

# File lib/graphviz.rb, line 346
def graph_count
  @hoGraphs.size
end
has_parent_graph?() click to toggle source
# File lib/graphviz.rb, line 775
def has_parent_graph?
   @oParentGraph
end
id() click to toggle source
Alias for: name
name() click to toggle source

Get the graph name

# File lib/graphviz.rb, line 646
def name
  @name.clone
end
Also aliased as: id
node_count() click to toggle source

Get the number of nodes

# File lib/graphviz.rb, line 180
def node_count
  @hoNodes.size
end
output( hOpts = {} ) click to toggle source

Generate the graph

Options :

  • :output : Output format (GraphViz::Constants::FORMATS)

  • :file : Output file name

  • :use : Program to use (GraphViz::Constants::PROGRAMS)

  • :path : Program PATH

  • :<format> => <file> : <file> can be

    • a file name

    • nil, then the output will be printed to STDOUT

    • String, then the output will be returned as a String

  • :errors : DOT error level (default 1)

    • 0 = Error + Warning

    • 1 = Error

    • 2 = none

# File lib/graphviz.rb, line 428
def output( hOpts = {} )
  xDOTScript = DOTScript.new
  lNotHugly = []

  append_attributes_and_types(xDOTScript)

  xDOTScript << "}"

  if has_parent_graph?
    xDOTScript.make_subgraph("#{GraphViz.escape(@name, :unquote_empty => true)}")
  else
    hOutput = {}

    hOpts.each do |xKey, xValue|
      xValue = xValue.to_s unless xValue.nil? or [Class, TrueClass, FalseClass].include?(xValue.class)
      case xKey.to_s
        when "use"
          if PROGRAMS.index( xValue ).nil?
            raise ArgumentError, "can't use '#{xValue}'"
          end
          @prog = xValue
        when "path"
          @path = xValue && xValue.split( "," ).map{ |x| x.strip }
        when "errors"
          @errors = xValue
        when "extlib"
          @extlibs = xValue.split( "," ).map{ |x| x.strip }
        when "scale"
          # Scale input by 'v' (=72)
          @scale = xValue
        when "inverty"
          # Invert y coordinate in output
          @inverty = xValue
        when "no_layout"
          # No layout mode 'v' (=1)
          @no_layout = xValue
        when "reduce"
          # Reduce graph
          @reduce_graph = xValue
        when "Lg"
          # Don't use grid
          @Lg = xValue
        when "LO"
          # Use old attractive force
          @LO = xValue
        when "Ln"
          # Set number of iterations to i
          @Ln = xValue
        when "LU"
          # Set unscaled factor to i
          @LU = xValue
        when "LC"
          # Set overlap expansion factor to v
          @LC = xValue
        when "LT"
          # Set temperature (temperature factor) to v
          @LT = xValue
        when "nothugly"
          begin
            require 'graphviz/nothugly'
            @nothugly = true
          rescue LoadError
            warn "You must install ruby-xslt or libxslt-ruby to use nothugly option!"
            @nothugly = false
          end
        else
          if FORMATS.index( xKey.to_s ).nil?
            raise ArgumentError, "output format '#{xValue}' invalid"
          end
          hOutput[xKey.to_s] = xValue
      end
    end

    @output = hOutput if hOutput.size > 0

    xStict = ((@strict && @oGraphType == "digraph") ? "strict " : "")
    xDOTScript.prepend(
      "#{xStict}#{@oGraphType} #{GraphViz.escape(@name, :unquote_empty => true)} {"
    )

    xOutputString = (@filename == String ||
      @output.any? {|format, file| file == String })

    xOutput = ""
    if @format.to_s == "none" or @output.any? {|fmt, fn| fmt.to_s == "none"}
      if xOutputString
        xOutput << xDOTScript
      else
        xFileName = @output["none"] || @filename
        open( xFileName, "w" ) do |h|
          h.puts xDOTScript
        end
      end
    end

    if (@format.to_s != "none" and not @format.nil?) or (@output.any? {|format, file| format != "none" } and @output.size > 0)
      ## Act: Save script and send it to dot
      t = Tempfile::open( File.basename(__FILE__) )
      t.print( xDOTScript )
      t.close

      cmd = find_executable( @prog, @path )
      if cmd == nil
        raise StandardError, "GraphViz not installed or #{@prog} not in PATH. Install GraphViz or use the 'path' option"
      end

      cmd = escape_path_containing_blanks(cmd) if IS_JRUBY

      xOutputWithFile = ""
      xOutputWithoutFile = ""
      unless @format.nil? or @format == "none"
        lNotHugly << @filename if @format.to_s == "svg" and @nothugly
        if @filename.nil? or @filename == String
          xOutputWithoutFile = "-T#{@format} "
        else
          xOutputWithFile = "-T#{@format} -o#{@filename} "
        end
      end
      @output.each_except( :key => ["none"] ) do |format, file|
        lNotHugly << file if format.to_s == "svg" and @nothugly
        if file.nil? or file == String
          xOutputWithoutFile << "-T#{format} "
        else
          xOutputWithFile << "-T#{format} -o#{file} "
        end
      end

      xExternalLibraries = ""
      @extlibs.each do |lib|
        xExternalLibraries << "-l#{lib} "
      end

      xOtherOptions = ""
      xOtherOptions += " -s#{@scale}" unless @scale.nil?
      xOtherOptions += " -y" if @inverty
      unless @no_layout.nil?
        xOtherOptions += " -n"
        xOtherOptions += "2" if @no_layout.to_i == 2
      end
      xOtherOptions += " -x" if @reduce_graph
      xOtherOptions += " -Lg" if @Lg
      xOtherOptions += " -LO" if @LO
      xOtherOptions += " -Ln#{@Ln}" unless @Ln.nil?
      xOtherOptions += " -LU#{@LU}" unless @LU.nil?
      xOtherOptions += " -LC#{@LC}" unless @LC.nil?
      xOtherOptions += " -LT#{@LT}" unless @LT.nil?

      if IS_JRUBY
        xCmd = "#{cmd} -q#{@errors} #{xExternalLibraries} #{xOtherOptions} #{xOutputWithFile} #{xOutputWithoutFile} #{t.path}"
      elsif IS_CYGWIN
        tmpPath = t.path
        begin
          tmpPath = "'" + `cygpath -w #{t.path}`.chomp + "'"
        rescue
          warn "cygpath is not installed!"
        end
        xCmd = "\"#{cmd}\" -q#{@errors} #{xExternalLibraries} #{xOtherOptions} #{xOutputWithFile} #{xOutputWithoutFile} #{tmpPath}"
      else
        xCmd = "\"#{cmd}\" -q#{@errors} #{xExternalLibraries} #{xOtherOptions} #{xOutputWithFile} #{xOutputWithoutFile} #{t.path}"
      end

      xOutput << output_from_command( xCmd )
    end

    # Not Hugly
    lNotHugly.each do |f|
      if f.nil? or f == String
        xOutput = GraphViz.nothugly( xOutput, false )
      else
        GraphViz.nothugly( f, true )
      end
    end

    if xOutputString
      xOutput
    else
      print xOutput
    end
  end
end
Also aliased as: save
root_graph() click to toggle source

Return the root graph

# File lib/graphviz.rb, line 679
def root_graph
  return( (self.pg.nil?) ? self : self.pg.root_graph )
end
save( hOpts = {} ) click to toggle source
Alias for: output
search_node(name) click to toggle source

Return the first node found in the current graph, and it subgraphs

# File lib/graphviz.rb, line 148
def search_node(name)
   n = get_node(name)
   return n unless n.nil?
   each_graph { |_, g|
      n = g.search_node(name)
      return n unless n.nil?
   }
   return nil
end
subgraph( xGraphName = nil, hOpts = {}, &block ) click to toggle source
Alias for: add_graph
to_s() click to toggle source
# File lib/graphviz.rb, line 639
def to_s
  self.output(:none => String)
end
type() click to toggle source

Return the graph type (graph digraph)

# File lib/graphviz.rb, line 336
def type
  @oGraphType
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.