Map<String, dynamic> toJson() => { 'nodes': nodes.map((n) => n.toJson()).toList(), 'edges': edges.map((e) => e.toJson()).toList(), };