Graph colouring: Difference between revisions
Content added Content deleted
(Add Ex4) |
(→{{Header|Python}}: Add Ex4) |
||
Line 214: | Line 214: | ||
('Ex2', "1-6 1-7 1-8 2-5 2-7 2-8 3-5 3-6 3-8 4-5 4-6 4-7"), |
('Ex2', "1-6 1-7 1-8 2-5 2-7 2-8 3-5 3-6 3-8 4-5 4-6 4-7"), |
||
('Ex3', "1-4 1-6 1-8 3-2 3-6 3-8 5-2 5-4 5-8 7-2 7-4 7-6"), |
('Ex3', "1-4 1-6 1-8 3-2 3-6 3-8 5-2 5-4 5-8 7-2 7-4 7-6"), |
||
('Ex4', "1-6 7-1 8-1 5-2 2-7 2-8 3-5 6-3 3-8 4-5 4-6 4-7"), |
|||
]: |
]: |
||
g = Graph(name, connections) |
g = Graph(name, connections) |
||
Line 260: | Line 261: | ||
#Nodes: 8 |
#Nodes: 8 |
||
#Edges: 12 |
#Edges: 12 |
||
#Colours: 2 |
#Colours: 2 |
||
Ex4 |
|||
1-6: Colour: 0, 1 |
|||
1-7: Colour: 0, 1 |
|||
1-8: Colour: 0, 1 |
|||
2-5: Colour: 2, 0 |
|||
2-7: Colour: 2, 1 |
|||
2-8: Colour: 2, 1 |
|||
3-5: Colour: 2, 0 |
|||
3-6: Colour: 2, 1 |
|||
3-8: Colour: 2, 1 |
|||
4-5: Colour: 2, 0 |
|||
4-6: Colour: 2, 1 |
|||
4-7: Colour: 2, 1 |
|||
#Nodes: 8 |
|||
#Edges: 12 |
|||
#Colours: 3</pre> |
|||
Python dicts preserve insertion order and Ex2/Ex3 edges are traced in a similar way which could be the cause of exactly the same colours used for Ex2 and Ex3. The wp article must use an earlier version of Python/different ordering of edge definitions. |
Python dicts preserve insertion order and Ex2/Ex3 edges are traced in a similar way which could be the cause of exactly the same colours used for Ex2 and Ex3. The wp article must use an earlier version of Python/different ordering of edge definitions. |
||
Ex4 changes the order of nodes enough to affect the number of colours used. |