Greedy colouring for decomposition trees of interval graphs and tests#34
Greedy colouring for decomposition trees of interval graphs and tests#34dia007 wants to merge 13 commits intotj-developers:intervalDecompositionfrom
Conversation
PhoenixIra
left a comment
There was a problem hiding this comment.
- Could you fix the issue with the CI fail?
- Could you also change your inputs to the decomposition as a Graph<Integer,E> and Map<Integer,Set>?
- And some other more minor stuff
| */ | ||
| protected Iterable<List<V>> getVertexOrdering() | ||
| { | ||
| System.out.println((Iterable<List<V>>) graph.vertexSet()); |
| /** | ||
| * The input graph | ||
| */ | ||
| private Graph<List<V>, E> graph; |
There was a problem hiding this comment.
Currently we do not use List as the vertex set, since Lists are not really efficient for set structures and using empty lists for the leaves/roots would break the tree structure. Instead we use Graph<Integer, E> and Map<Integer,Set>. Could you change this in your implementation?
| for(List<V> outerVertex:getVertexOrdering() ) { | ||
|
|
||
| //the case of a generalised decomposition tree | ||
| /* for (E edge: graph.edgesOf(outerVertex)) { |
There was a problem hiding this comment.
Do you need this code? If not, remove it. If yes, remove it and if you will need it, use this commit to get the code.
There was a problem hiding this comment.
Yes, you are right. I do not need it.
| int maxColourAssigned = Collections.max(asssignedColors.values()); | ||
|
|
||
|
|
||
| System.out.println(Arrays.asList(asssignedColors)); |
| Coloring<Integer> coloring = new DecompositionTreeColour<>(newGraph).getColoring(); | ||
| assertEquals(3, coloring.getNumberColors()); | ||
| Map<Integer, Integer> colors = coloring.getColors(); | ||
| assertEquals(0, colors.get(1).intValue()); |
There was a problem hiding this comment.
You should not assume the color here. Instead test whether vertices differ in they color or have the same color, so that if in a future commit, the algorithm get changed and results another (valid i.e. by renaming) coloring, this tests will also accept the result.
| Coloring<Integer> coloring = new DecompositionTreeColour<>(newGraph).getColoring(); | ||
| assertEquals(3, coloring.getNumberColors()); | ||
| Map<Integer, Integer> colors = coloring.getColors(); | ||
| assertEquals(0, colors.get(1).intValue()); |
|
It would be good to move this into the color package |
b2406e8 to
3542b5a
Compare
3542b5a to
b46bb2a
Compare
Changed the parameters and incorporated minor changes