Skip to content

Instantly share code, notes, and snippets.

@naterush
Last active October 16, 2017 13:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naterush/d867fe35ecb63c42e6c1f053e2ff33a8 to your computer and use it in GitHub Desktop.
Save naterush/d867fe35ecb63c42e6c1f053e2ff33a8 to your computer and use it in GitHub Desktop.
Reasoning behind the safety oracle that uses Turan's Theorem. Can be found here: https://en.wikipedia.org/wiki/Tur%C3%A1n%27s_theorem
Turán's Theorem: Let G be any graph with n vertices, such that G is K_{r+1}-free - that is, it has no clique of size r+1 or greater. Then the number of edges in G is at most:
(r-1) / r * n^2 / 2
Let us say that we have e edges in our graph, and solve for r
e = (r-1) / r * n^2 / 2
er = (r-1) * n^2 / 2
er = rn^2 / 2- n^2 / 2
er - rn^2 / 2= - n^2 / 2
r (e - n^2/2) = - n^2 / 2
r (n^2/2 - e) = n^2 / 2
r = n^2 / (2(n^2/2 - e))
r = n^2 / (n^2 - 2e)
Thus, we can say that in a graph w/ n nodes and e edges, there is at least a clique of size ceiling(n^2 / (n^2 - 2e)).
@djrtwo
Copy link

djrtwo commented Oct 16, 2017

Throw in an extra set of parenthesis for the eyes

e = [(r-1) / r] * [n^2 / 2]

@djrtwo
Copy link

djrtwo commented Oct 16, 2017

why ceiling?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment