explain how each of these constraints can be expressed in propositional logic. It is not asking for code, just propositional logic sentences I am attaching the code as well;   Python code: import numpy as np MAX = 100; # Stores the vertices store = [0]* MAX; # Graph graph = np.zeros((MAX, MAX)); # Degree of the vertices d = [0] * MAX; # Function to check if the given set of vertices # in store array is a clique or not def is_clique(b) : # Run a loop for all the set of edges # for the select vertex for i in range(1, b) : for j in range(i + 1, b) : # If any edge is missing if (graph[store[i]][store[j]] == 0) : return False; return True; # Function to print the clique def print_cli(n) : for i in range(1, n) : print(store[i], end = " "); print(",", end=" "); # Function to find all the cliques of size s def findCliques(i, l, s) : # Check if any vertices from i+1 can be inserted for j in range( i + 1, n -(s - l) + 1) : # If the degree of the graph is sufficient if (d[j] >= s - 1) : # Add the vertex to store store[l] = j; # If the graph is not a clique of size k # then it cannot be a clique # by adding another edge if (is_clique(l + 1)) : # If the length of the clique is # still less than the desired size if (l < s) : # Recursion to add vertices findCliques(j, l + 1, s); # Size is met else : print_cli(l + 1); # Driver code if name == "main" : edges = [ [ 1, 2 ], [ 2, 3 ], [ 3, 1 ], [ 4, 3 ], [ 4, 5 ], [ 5, 3 ] ]; k = 3; size = len(edges); n = 5; for i in range(size) : graph[edges[i][0]][edges[i][1]] = 1; graph[edges[i][1]][edges[i][0]] = 1; d[edges[i][0]] += 1; d[edges[i][1]] += 1; findCliques(0, 1, k)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

explain how each of these constraints can be expressed in propositional logic. It is not asking for code, just propositional logic sentences

I am attaching the code as well;

 

Python code:
import numpy as np

MAX = 100;

# Stores the vertices
store = [0]* MAX;

# Graph
graph = np.zeros((MAX, MAX));

# Degree of the vertices
d = [0] * MAX;

# Function to check if the given set of vertices
# in store array is a clique or not
def is_clique(b) :

# Run a loop for all the set of edges
# for the select vertex
for i in range(1, b) :
for j in range(i + 1, b) :

# If any edge is missing
if (graph[store[i]][store[j]] == 0) :
return False;

return True;

# Function to print the clique
def print_cli(n) :

for i in range(1, n) :
print(store[i], end = " ");
print(",", end=" ");

# Function to find all the cliques of size s
def findCliques(i, l, s) :

# Check if any vertices from i+1 can be inserted
for j in range( i + 1, n -(s - l) + 1) :

# If the degree of the graph is sufficient
if (d[j] >= s - 1) :

# Add the vertex to store
store[l] = j;

# If the graph is not a clique of size k
# then it cannot be a clique
# by adding another edge
if (is_clique(l + 1)) :

# If the length of the clique is
# still less than the desired size
if (l < s) :

# Recursion to add vertices
findCliques(j, l + 1, s);

# Size is met
else :
print_cli(l + 1);

# Driver code
if name == "main" :

edges = [ [ 1, 2 ],
[ 2, 3 ],
[ 3, 1 ],
[ 4, 3 ],
[ 4, 5 ],
[ 5, 3 ] ];
k = 3;
size = len(edges);
n = 5;

for i in range(size) :
graph[edges[i][0]][edges[i][1]] = 1;
graph[edges[i][1]][edges[i][0]] = 1;
d[edges[i][0]] += 1;
d[edges[i][1]] += 1;

findCliques(0, 1, k);

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Maximum Flow
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education