Get rid of the hand-crafted equivalence definition for QueryGraph

We moved out the pattern -> query graph lookup table into the context.

Enabling the proper QueryGraph equality exposed issues with how we handle
optional matches and WITH.
Merge pull request #2387 from jakub-/query-graph-equivalence

Get rid of the hand-crafted equivalence definition for QueryGraph