class Graph { new make(Node[] nodes := Node[,], Edge[] edges := [,]) { this.nodes = nodes this.edges = edges } Node[] nodes Edge[] edges } class Node { Str name new make(Str name) { this.name = name } override Int hash() { name.hash } override Bool equals(Obj? other) { other is Node && other->name == name } override Str toStr() { "node($name)" } } class Edge { Node from Node to new make(Node from, Node to) { this.from = from; this.to = to } override Int hash() { [from, to].hash } override Bool equals(Obj? other) { other is Edge && other->from == from && other->to == to } override Str toStr() { "$from -> $to" } }