What Makes an Algorthim Greedy [Graph Coloring Algorithm] I have a simple graph G = (V,E) and each vertex has a range [a,b].Every two vertices are connected only if [a_1,b_1] and [a_2,b_2] have a common subrange.
Each range of vertex is rV1 = [0,5] rV2 = [1,3] rV3 = [2,10]
rV4 = [4,9] rV5 = [6,7] rV6 = [8,12] rV7 = [11,13]
Graph Created based on above ranges.
Based on the algorithm below i have to color the graph.
ranges = rV1,rV2,rV3,rV4,rV5,rV6,rV7...

COLOR_INTERVAL_GRAPH(rV1,rV2,rV3,rV4,rV5,rV6,rV7...){
if(number of rVi &gt; 0){
 C_m  = MAXIMAL_COLOR_CLASS(rV1,rV2,rV3,rV4,rV5,rV6,rV7...);
 //paint C_m vertices with color m.
 //new_ranges &lt;- remove C_m from rV1,rV2,rV3,rV4,rV5,rV6,rV7...
 return {C_m} U COLOR_INTERVAL_GRAPH(new_ranges)
 else:
   return []

MAXIMAL_COLOR_CLASS(new_range){
C = []
i = 1
while(i &lt;= new_range.size()){
  C = C U {Vi}
  j = i+1
  while(j &lt;= new_range.size() AND rVi (not common subrange with rVj)){
  j = j+1
i=j
return C

How i know if the above algorithm uses the greedy strategy?
My work so far:
The algorithm has the 'greedy choice property' since it paints the most each turn, by choosing the best solution to the current subproblem without caring about future problems or backtracking.(can this be improved and how)?
Graph Colored (Is the graph colored correctly?).
&quot;A greedy algorithm is any algorithm that follows the problem-solving heuristic of making the locally optimal choice at each stage.&quot; (from Wikipedia)  In other words, it does not backtrack.  It builds up the solution incrementally, and when it adds something to the solution-so-far, it never later removes it (or, when it makes a decision, it never later undoes that decision).
Does that describe the algorithm you are looking at?
If you want to justify that it satisfies the greedy choice property, it might help to precisely state what is the &quot;subproblem&quot; that is solved at each step.