Maybe just return `g` or `nodes`. One can be found from the other easily. I would advocate for just `nodes`