ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 29 Jun 2020 20:55:59 +0200Adding edges to a graphhttps://ask.sagemath.org/question/52261/adding-edges-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)
listbottled-capsMon, 29 Jun 2020 20:55:59 +0200https://ask.sagemath.org/question/52261/