Made graph a generic class with N as generic node type