Refactored graph and workflow to reduce coupling.

The graph no longer needs to know about the various types of tasks that are possible in the workflow.