Each variable in a program fragment has a range of times during which its value must be stored in register, particularly after it is initialized and before its final use. Any two variables whose life spans intersect cannot be placed in the same register. In the below graph, each vertex corresponds to a variable, with an edge between any two vertices whose variable life spans intersect.
Devise an algorithm and identify all the variables that can be assigned to the same register and the minimum number of registers required.