Talk:Greedy coloring/Archives/2021

Running time
What is the order of the number of steps the greedy algorithm needs to colour a graph on n vertices? This is a personal question, but also a suggestion for content to be added to the article. 86.196.177.253 (talk) 22:39, 4 September 2009 (UTC)


 * It depends on how the vertex ordering is found. Once the vertices are ordered, the rest is linear. —David Eppstein (talk) 00:40, 5 September 2009 (UTC)


 * Ok, suppose that the vertices are already ordered from 1 to n, in a random fashion. Then when the algorithm is at vertex i, it has to scan all potential edges ij with j < i, taking exactly i - 1 steps. Therefore, the total number of steps is 1 + 2 + ... + (n-1), which is of order n^2, no? 86.210.207.133 (talk) 16:31, 5 September 2009 (UTC)


 * The standard assumption for sparse graphs is that they are represented as an adjacency list. So you don't have to scan all potential edges, only the ones that actually exist, taking a total amount of time that is linear in the size of the graph. To be more specific, you can create a vector of boolean values (is this color available) the length of which is the degree of the vertex plus one, then scan the edges checking off the colors that are used, then scan the vector to find the first free color. —David Eppstein (talk) 18:11, 5 September 2009 (UTC)


 * Ok, but what do you mean by sparse graph? I'm interested in random graphs with edge probability 1/2. Are those sparse? (BTW, thanks for your time and patience.) 86.210.207.133 (talk) 20:11, 5 September 2009 (UTC)
 * By sparse I mean that the number of edges is a tiny fraction of the number of possible edges. For a random graph with edge probability 1/2, you are going to have roughly n2/4 edges, so it's as efficient to do what you suggested earlier, testing all potential edges: a running time of O(n2) is linear in the input size. —David Eppstein (talk) 20:29, 5 September 2009 (UTC)
 * "a running time of O(n2) is linear in the input size" is that so the terminology? Isn't O(n2) 'quadratic in the input size'? 86.210.207.133 (talk) 20:49, 5 September 2009 (UTC)
 * No, the input size is also &Theta;(n2), because you need to somehow specify which edges are present and which aren't. So the input size and the running time are within a constant factor of each other; that's what I mean by "linear in the input size". —David Eppstein (talk) 21:09, 5 September 2009 (UTC)
 * Got you! Many thanks David. 86.210.207.133 (talk) 23:14, 5 September 2009 (UTC)

Perfect elimination ordering from perfect ordering
"Chordal graphs are perfectly orderable; a perfect ordering of a chordal graph may be found by reversing a perfect elimination ordering for the graph."

Is this relationship bidirectional? Is a reversed perfect ordering always a perfect elimination ordering, or not necessarily? Ged.R (talk) 11:23, 18 August 2010 (UTC)
 * I don't think so. If G is a three-vertex path graph then G is chordal, every ordering of G is a perfect ordering, but not every ordering is a perfect elimination ordering. —David Eppstein (talk) 16:43, 18 August 2010 (UTC)

The upperright figure to show the bad case of greedy coloring is wrong
The right part of the figure should be colored in 4 colors, not 8. Please correct it. — Preceding unsigned comment added by PengUBC (talk • contribs) 00:41, 19 February 2014 (UTC)
 * Huh? It is colored in four colors already. Vertices 1 & 2 are red, vertices 3 & 4 are blue, vertices 5 & 6 are green, and vertices 7 & 8 are yellow. —David Eppstein (talk) 01:45, 19 February 2014 (UTC)

Grundy coloring versus Greedy coloring
Given a coloring c : V → {1, 2,. . ., k}, a node i is called a Grundy node if c(i) = min { l ≥ 1 | ∀j ∈ N(i) c(j) ≠ l}. In a grundy coloring all nodes are Grundy.

Greedy coloring should be compared to Grundy coloring (I believe that a greedy coloring is also a grundy coloring and vis-versa)

reference on Grundy coloring : Sons, New York, 1995. — Preceding unsigned comment added by 2001:660:6101:402:4D26:113B:7FFD:C4FA (talk) 13:49, 20 September 2018 (UTC)
 * P.M. Grundy, Mathematics and games, Eureka 2 (1939) 6–8.
 * T.R. Jensen, B. Toft, Graph Coloring Problems, John Wiley &