creating basic structure of an undirected graph