Changed graph structure from array to 2-d dict