Input

Graphviz

In addition there is a bit of magic that detects graphviz code, so input of the following form will also work:

digraph Graph1 {
"Bonn" -> "Berlin"
}

Note that the magic detection only works for named graphs or graph with "digraph" at their start, so the following will not be detected as graphviz code because it looks exactly like valid Graph::Easy code at the start:

The object $graph will now contain nodes that are of your custom class instead of plain Graph::Easy::Node.

When overriding nodes, you also should provide subclasses for Graph::Easy::Node::Anon and Graph::Easy::Node::Empty, and make these subclasses of your custom node class as shown above. For edges, groups and graphs, you need just one subclass.