map<T1 extends Object, NewNode extends GraphNode<T1>> method

  1. @override
Graph<T1, NewNode> map<T1 extends Object, NewNode extends GraphNode<T1>>(
  1. NewNode createNode(
    1. T
    )
)
override

Map every node in the graph to an new node type. It may be used for converting from one specialized GraphNode implementation to another, or for converting each GraphNode value from type T to type NewT for example.

Implementation

@override
Graph<T1, NewNode> map<T1 extends Object, NewNode extends GraphNode<T1>>(
  NewNode Function(T) createNode,
) {
  final visited = <Node, NewNode>{};
  final NewNode newRootNode =
      _createOrGetMappedNode(_root, createNode, visited);
  return RootGraph<T1, NewNode>(newRootNode);
}