removeOrphanNodes method

  1. @protected
  2. @visibleForTesting
void removeOrphanNodes()

Removes orphan nodes (i.e. nodes without edges)

Implementation

@protected
@visibleForTesting
void removeOrphanNodes() {
  final orphanEntries = {...toMap()}.entries.where((e) => e.value.isEmpty);
  for (final e in orphanEntries) {
    _removeNode(e.key);
  }
}