Ask Your Question

Revision history [back]

adding an edge to a graph

This is my first time using this forum so please let me know if more information is needed

I am trying to some basic conjecture testing, so I'm not too concerned about runtime. I am trying to count graphs which are "maximal triangle-free and 3-colorable", ie triangle-free and 3-colorable, and adding any missing edge breaks one of those 2 properties. But I don't know how to test that property about adding edges to a graph, since I don't know how to add edges to a graph. I'm mainly using the Sage page on undirected graphs. My rudimentary code so far is below:

n = 5 list = []
for i in range(1,n): list.append([]) for g in graphs(i): if g.is_triangle_free() and g.chromatic_number() <= 3: list[i-1].append(g) list