Create cost linear function. Create graph structure.