clean graph generator, use abstract factory design pattern