Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Greedy coloring for graphs/digraphs #50

Merged
merged 1 commit into from
Mar 26, 2015
Merged

Greedy coloring for graphs/digraphs #50

merged 1 commit into from
Mar 26, 2015

Conversation

danshapero
Copy link
Contributor

This PR includes a greedy coloring algorithm using the first-fit heuristic and some accompanying tests.

@aysylu
Copy link
Owner

aysylu commented Mar 8, 2015

Thanks, this looks great! Could you please add just 1 failure test case for greedy-coloring? So that we can document what the failure case returns. I'll merge once the test case is in.

@danshapero
Copy link
Contributor Author

Hm, I'm not quite sure what you have in mind -- could you elaborate?

The greedy-coloring function should (I hope!) produce a valid coloring for any graph, although it might use more colors than the graph's chromatic number. I didn't want to check for specific output from greedy-coloring, because that'll depend on the unimportant detail of the order in which you visit all the vertices. The coloring? predicate is there to check validity of the output instead, but I test that function against specific colorings I did by hand for some of your test graphs.

@aysylu
Copy link
Owner

aysylu commented Mar 26, 2015

Sorry, what I meant is it'd be nice to show that on a simple "triangle" graph greedy-coloring produces 3 colors. I'm merging the PR as is and will add the test myself.

Thanks for your contribution!

aysylu pushed a commit that referenced this pull request Mar 26, 2015
Greedy coloring for graphs/digraphs
@aysylu aysylu merged commit f9e08ea into aysylu:master Mar 26, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants