Merge "Fix some bugs in graph construction/simplification methods."