class GV::BaseGraph
Public Instance Methods
@return whether this graph is directed
# File lib/gv.rb, line 188 def directed? LibCGraph.agisdirected(ptr) == 1 end
Creates a new edge @param name [String] the name (identifier) of the edge @param tail [Node] the edge's tail node @param head [Node] the edge's head node @param attrs [Hash{String, Symbol => Object}] the attributes to associate with this edge @see www.graphviz.org/doc/info/attrs.html Node
, Edge
and Graph
Attributes @return [Edge] the newly created edge
# File lib/gv.rb, line 170 def edge(name, tail, head, attrs = {}) component Edge, [name, tail, head], attrs end
Creates a new node @param name [String] the name (identifier) of the node @param attrs [Hash{String, Symbol => Object}] the attributes to associate with this node @see www.graphviz.org/doc/info/attrs.html Node
, Edge
and Graph
Attributes @return [Node] the newly created node
# File lib/gv.rb, line 158 def node(name, attrs = {}) component Node, [name], attrs end
@return whether this graph is strict
# File lib/gv.rb, line 193 def strict? LibCGraph.agisstrict(ptr) == 1 end
Creates a new sub-graph @param name [String] the name (identifier) of the sub-graph @param attrs [Hash{String, Symbol => Object}] the attributes to associate with this sub-graph @see www.graphviz.org/doc/info/attrs.html Node
, Edge
and Graph
Attributes @return [SubGraph] the newly created sub-graph
# File lib/gv.rb, line 180 def sub_graph(name, attrs = {}) graph = component SubGraph, [name], attrs yield graph if block_given? graph end
Private Instance Methods
# File lib/gv.rb, line 198 def component(klass, args, attrs = {}) comp = klass.new self, *args attrs.each do |attr, value| comp[attr] = value end comp end