fixed bug for defining a graph