It's a bit unfortunate that the `node_map` in both cases has different constness, so a conversion or `reinterpret_cast` is necessary. For now a new temporary map is created as this is less error prone. That's not ideal but better than the duplication from before.