graph api implementation and some test cases