class Graph::Attribute

An attribute for a graph, node, or edge. Really just a composable string (via #+) with a convenience method << that allows you to “paint” nodes and edges with this attribute.

Public Instance Methods

+(style) click to toggle source

Compose a new attribute from two existing attributes:

bad_nodes = red + filled + diamond
# File lib/graph.rb, line 463
def + style
  c =
  c.push self
  c.push style
<<(thing) click to toggle source

“Paint” graphs, nodes, and edges with this attribute.

red << node1 << node2 << node3

is the same as:

node1.attributes << red
node2.attributes << red
node3.attributes << red
# File lib/graph.rb, line 448
def << thing
  thing.attributes << self