generic graph generator