Disjunctive graph

In the mathematical modeling of job shop scheduling problems, disjunctive graphs are a way of modeling a system of tasks to be scheduled and timing constraints that must be respected by the schedule. They are mixed graphs, in which vertices (representing tasks to be performed) may be connected by both directed and undirected edges (representing timing constraints between tasks). The two types of edges represent constraints of two different types: Pairs of tasks that have no constraint on their ordering – they can be performed in either order or even simultaneously – are disconnected from each other in the graph.
 * If one task x must be performed earlier than a second task y, this constraint is represented by a directed edge from x to y.
 * If, on the other hand, two tasks x and y can be performed in either order, but not simultaneously (perhaps because they both demand the use of the same equipment or other resource), this non-simultaneity constraint is represented by an undirected edge connecting x and y.

A valid schedule for the disjunctive graph may be obtained by finding an acyclic orientation of the undirected edges – that is, deciding for each pair of non-simultaneous tasks which is to be first, without introducing any circular dependencies – and then ordering the resulting directed acyclic graph. In particular, suppose that all tasks have equal length and the goal is to find a schedule that minimizes the makespan, the total time until all tasks have been completed. In this case, the makespan can be computed from the longest path in the oriented graph, which can be found in polynomial time for directed acyclic graphs. However, the orientation stage of the solution is much more difficult: it is NP-hard to find the acyclic orientation that minimizes the length of the longest path. In particular, by the Gallai–Hasse–Roy–Vitaver theorem, if all edges are initially undirected, then orienting them to minimize the longest path is equivalent to finding an optimal graph coloring of the initial undirected graph.