adding an edge to a graph [closed]

asked 2020-06-29 21:27:23 +0100

bottled-caps gravatar image

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

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by tmonteil
close date 2020-06-30 23:46:53.861844