Add WelshPowell (Graph Colouring)#5034
Conversation
|
i try to format based on clang format but i cant. Dowloaded llvm added to enviroment variables and path and then my computer finds the clang format. After that i dont know what to do. |
You can have a look at the log and introduce the required changes manually. If you are having trouble with running |
vil02
left a comment
There was a problem hiding this comment.
This is just the first iteration.
…well.java Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
|
i think i changed everything you asked, please inform me if i need to change or fix anything else. |
…ell.java Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
…thods in order for the test class to work
…thods in order for the test class to work
…ut works. (working on it :) )
vil02
left a comment
There was a problem hiding this comment.
Regarding the general design of this class, I would suggest the following (pseudo code):
class WelshPowell {
private static class WPGraph {
// almost same as now
}
public static WPGraph makeGraph(int numberOfVertices, listOfEdges) {
// here you create the graph
}
public static int[] welshPowellColoring(WPGraph graph) {
// as it is now
}
}Then, you could write the first test like (still pseudo code)
final var graph = WelshPowell.makeGraph(3, {{0, 1}, {1, 2}, {2, 0}});
final var colors = WelshPowell.welshPowellColoring(graph);
// check if the colors is as expected
assert(...);Thanks to this, you will be able to get rid of some methods.
vil02
left a comment
There was a problem hiding this comment.
We are almost there! Let's sped some time to make everything perfect.
…makeGraph so the listofEdges haw exactly 2 elements, and add a more complex graph in the test class
|
i think i resolved almost all of the changes requested. Have a look and let me know if anything else needs to be changed. |
vil02
left a comment
There was a problem hiding this comment.
Please add the missing tests. By the way, in same cases you can use Commit suggestion button. It is quite handy.
|
i added the complex test based on the website, add the blank_color method, updated the comments on the precolored test, and followed all your suggestions. Have a look for any minor changes needed but all in all I think it is ready. |
WelshPowell (Graph Colouring)
vil02
left a comment
There was a problem hiding this comment.
Good work!
For a future project you can consider adding a method trying to determine if the returned coloring is optimal.
clang-format -i --style=file path/to/your/file.java