equals for graphs