Returns a function that assigns specific variables from the given values.
This function provides a mechanism for performing assignment of variables to values in a way that does not fill the graph with large assignment values.
var_names_to_values: A map from variable names to values.
A function that takes a single argument, a
ValueError: if any of the given variable names were not found.