Pull out more code from GreedyPlanningStrategy
Merge pull request #2287 from boggle/master

Pull out more code from GreedyPlanningStrategy
Refactoring of LogicalPlan and QueryGraph

A LogicalPlan now has a `solved` field, that indicates the
corresponding QueryGraph that the plan solves.

QueryGraph now only exists in one version - the difference
between Optional and mandatory patterns is seen by where
the QueryGraph is used and not by a different type.