Class | GraphViz

In:

lib/graphviz/attrs.rb
lib/graphviz/edge.rb
lib/graphviz/elements.rb
lib/graphviz/ext.rb
lib/graphviz/family_tree/couple.rb
lib/graphviz/family_tree/generation.rb
lib/graphviz/family_tree/person.rb
lib/graphviz/family_tree/sibling.rb
lib/graphviz/family_tree.rb
lib/graphviz/graphml.rb
lib/graphviz/math/matrix.rb
lib/graphviz/node.rb
lib/graphviz/nothugly.rb
lib/graphviz/theory.rb
lib/graphviz/types/esc_string.rb
lib/graphviz/types/gv_double.rb
lib/graphviz/types/html_string.rb
lib/graphviz/types/lbl_string.rb
lib/graphviz/types.rb
lib/graphviz/xml.rb
lib/graphviz.rb

Parent: | Object

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

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

>> puts x.inspect.gsub( "\\", "\" ) "hello\n\t\l\"world\""

OR

>> x = ‘hello\n\t\l"world"’

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

>> puts x.inspect.gsub( "\\", "\" ) "hello\n\t\l\"world\""

### Methods

- << > >> [] []= add_edge add_graph add_node default each_attribut each_edge each_graph each_node edge_count get_edge_at_index get_graph get_node get_node_at_index graph_count id name new node_count nothugly options output parse root_graph save subgraph type

### Included Modules

Constants GVUtils

### Classes and Modules

Class GraphViz::Attrs
Class GraphViz::Edge
Class GraphViz::Elements
Class GraphViz::Ext
Class GraphViz::FamilyTree
Class GraphViz::GraphML
Class GraphViz::Math
Class GraphViz::Node
Class GraphViz::Theory
Class GraphViz::Types
Class GraphViz::XML

### External Aliases

graph | -> | graph_attrs
node | -> | node_attrs
edge | -> | edge_attrs

### Attributes

edge | [RW] | This accessor allow you to set global edges attributs
graph | [RW] | This accessor allow you to set global graph attributs
node | [RW] | This accessor allow you to set global nodes attributs

### Public Class methods

default( hOpts )

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

new( xGraphName, hOpts = {} ) {|self| ...}

Create a new graph object

Options :

- :output : Output format (Constants::FORMATS) (default : dot)
- :file : Output file name (default : nil)
- :use : Program to use (Constants::PROGRAMS) (default : dot)
- :path : Program PATH
- :parent : Parent graph (default : nil)
- :type : Graph type (Constants::GRAPHTYPE) (default : digraph)
- :errors : DOT error level (default 1)
  - 0 = Error + Warning
  - 1 = Error
  - 2 = none

nothugly( file, save = true )

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" )

options( hOpts )
parse( xFile, hOpts = {} ) {|graph| ...}

Create a new graph from a GraphViz File

Options :

- :output : Output format (Constants::FORMATS) (default : dot)
- :file : Output file name (default : none)
- :use : Program to use (Constants::PROGRAMS) (default : dot)
- :path : Program PATH

### Public Instance methods

-( oNode )

Alias for #<<

<<( oNode )

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

>( oNode )

Alias for #<<

>>( oNode )

Alias for #<<

[]( xAttrName )

Get the value of the graph attribut `xAttrName`

[]=( xAttrName, xValue )

Set value `xValue` to the graph attribut `xAttrName`

add_edge( oNodeOne, oNodeTwo, hOpts = {} )

Create a new edge

In:

- oNodeOne : First node (or node list)
- oNodeTwo : Second Node (or node list)
- hOpts : Edge attributs

add_graph( xGraphName = nil, hOpts = {}, &block )

Create a new graph

In:

- xGraphName : Graph name
- hOpts : Graph attributs

add_node( xNodeName, hOpts = {} )

Create a new node

In:

- xNodeName : Name of the new node
- hOpts : Node attributs

Return the GraphViz::Node object created

each_attribut() {|k,v| ...}

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

each_edge( ) {|edge| ...}

Allow you to traverse edges

each_graph( ) {|name, graph| ...}

Allow you to traverse graphs

each_node( ) {|name, node| ...}

Allow you to traverse nodes

edge_count()

Get the number of edges

get_edge_at_index( index )

Return the edge object for the given index

get_graph( xGraphName ) {|graph| ...}

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

get_node( xNodeName ) {|node| ...}

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

get_node_at_index( index )

Return the node object for the given index

graph_count()

Get the number of graphs

id()

Alias for name

name()

Get the graph name

node_count()

Get the number of nodes

output( hOpts = {} )

Generate the graph

Options :

- :output : Output format (Constants::FORMATS)
- :file : Output file name
- :use : Program to use (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

root_graph()

Return the root graph

save( hOpts = {} )

Alias for output

subgraph( xGraphName = nil, hOpts = {}, &block )

Alias for add_graph

type()

Return the graph type (graph digraph)

[Validate]