This is a helper fn private to the namespace. Changing the argument order simplifies implementation of the public fns, as it allows you to use partial. The public fns take graph as the 1st argument.