1) align the gap for the graph instead of the matrix
2) fixed one "==" problem for control flow