Assessing and Improving Generalization in Graph Reasoning and Learning