version for all kinds of graph