Edge Attributes

Attributes required for graph layout and graph rendering are always stored as key value pairs in the form: g[key] or g.key, Only strings are allowed as keys. Any number of user defined string attributes, which are not necessarily used by the graphviz library can be set.

With it's creation each node receives  one of the following read-only attributes.

Attribute Key Value Type Description Notes
graph userdata Graph to which the given node belongs
head userdata Head node of the edge
id number Graphviz' internal unique edge id.
name string Name of the edge. Note, this is NOT the edge's label.
tail userdata Tail node of the edge

Edge Methods

result = e:delete()

Deletes the given edge.  Lua userdata objects associated with the edge, are invalidated and eventually deleted during garbage collection. Any attempt to access the edge will result in a runtime error.

Note, that the nodes which are connected by the edge are not deleted.

The function returns a non-nil value on success.

result = e:rawget(KEY)

Retrieves an attributes from an edge  object n without using Lua metamethods. Attributes are always returned as strings.

The function returns nil if there is no attribute with  KEY could be found.

result = e:type()

See g:type() 

Edge Metamethods


e1 == e2

Edges can be compared using the == operator. The comparison returns true if the edges are identical (have equal attributes id). It returns false otherwise.