Issue 6298 dataflow graph 1

Extract the graph abstraction used in region inference and make it available as a general purpose module. First step towards establishing a common basis for forward and reverse dataflow.

r? @pcwalton