Graph colouring: Difference between revisions
Content added Content deleted
(→{{Header|Python}}: Ex2 fix) |
(Add Ex4) |
||
Line 118: | Line 118: | ||
+-------------------+ |
+-------------------+ |
||
</pre> |
</pre> |
||
;Ex4: |
|||
This is the same graph, node naming, and edge order as Ex2 except some of the edges x-y are flipped to y-x. |
|||
This might alter the node order used in the greedy algorithm leading to differing numbers of colours. |
|||
1-6 7-1 8-1 5-2 2-7 2-8 3-5 6-3 3-8 4-5 4-6 4-7 |
|||
<pre> |
|||
+-------------------------------------------------+ |
|||
| | |
|||
| | |
|||
+-------------------+---------+ | |
|||
| | | | |
|||
+---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ |
|||
| 4 | --- | 5 | --- | 2 | --- | 7 | --- | 1 | --- | 6 | --- | 3 | --- | 8 | |
|||
+---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ |
|||
| | | | | | |
|||
+---------+-----------------------------+---------+ | | |
|||
| | | | |
|||
| | | | |
|||
+-----------------------------+-------------------+ | |
|||
| | |
|||
| | |
|||
+-----------------------------+ |
|||
</pre> |
|||
=={{Header|Python}}== |
=={{Header|Python}}== |