toString method

  1. @override
String toString()
override

Returns a string representation of the graph.

Implementation

@override
String toString() {
  var b = StringBuffer();
  b.writeln('{');
  for (var vertex in _vertices.value) {
    b.write(' $vertex: ');
    b.write('[');
    b.writeAll(_edges[vertex] ?? [], ', ');
    b.write('],');
    b.writeln('');
  }
  b.write('}');
  return b.toString();
}