Graph structure problem, is my code correct? - C#