Add comments of graph and modify code style
Add assert in testing cases