Author | Anurag Bishnoi |
Date | 2017-11-01T14:09:32 |
Original file | R34.sagews |
# program for determining all distinct red/blue-colourings of K_8 which do not have a red K_3 or a blue K_4
# you can run this code on SageMath, either by using the cloud (CoCalc) or by installing it on your machine
# go to http://www.sagemath.org/
L = graphs.nauty_geng(8)
# generates all graphs on 8 vertices with exactly one graph from each isomorphism class
# it uses the program called nauty, created by Brendan McKay, for doing so
Red = [G for G in L if G.clique_number() < 3 and G.complement().clique_number() < 4]
# filters out those graphs which have no clique of size 3 and no independent set of size 4
print len(Red)
# the number of elements in the set "Red"
# we will now plot these 3 graphs
for G in Red:
G.plot()