Adding some graph methods and its test.