added generics to Graph