3 clique problem
Budget $10-30 USD
- Freelancer
- Emplois
- Python
- 3 clique problem
The CLIQUE problem takes as input an undirected graph G = (V, E) and an integer k > 2,
and returns True if G contains a clique of size k, i.e a set of vertices C ⊆ V such that |C| = k
and (u, v) ∈ E for all u, v ∈ C.
1. Write a function clique_solver(G,k) that takes a graph G (described below) and integer
k as input and return a Boolean: True in that case that G contains a clique of size k and
False otherwise.
2. Write a function sat_to_clique(F) that takes a formula F (described below) as input and
return a graph G and integer k as output such that:
F is satisfiable ⇐⇒ G has a clique of size k.
3. Write a function sat_solver(F) that makes use of your previous two functions and takes
a formula F as input and returns a Boolean: True in the case where F is satisfiable and
False otherwise.
4. Describe in your own words, how your function sat_solver(F) works and why it is able to
successfully determine whether the input formula F is satisfiable.
Futher Details
You should make use of the following pre-defined classes ]
add_vertex(v) Adds a vertex v to the graph. Returns null.
add_edge(u,v) Adds an undirected edge to the graph from u to v. Adds vertices u and v if not already present. Returns null.
get_vertices() Returns a list of all vertices.
get_edges() Returns a list of all edges.
has_edge(u,v) Returns True if there is an (undirected) edge between u and v.
Formula
get_clauses() Returns a list of Clauses (described below)
Clause
get_literals() Returns a list of integers representing each clause
(positive literals are represented by positive integers and their corresponding negative literals as their negative counterpart. For example, if P is represented by the integer 2 then ¬P is represented by −2. etc.)
Décerné à:
I can make it in python3 with the mentioned information . If you have any other requirements you can ask for it.