storing nodes in graph