Switched to an approach where the functions are added as the payload on the graph's nodes.
Made some tweaks to improve test coverage. I think they made the design better too :)