Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8174453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:27:47+00:00 2026-06-06T22:27:47+00:00

I have a set of variables S , and a boolean function f defined

  • 0

I have a set of variables S, and a boolean function f defined on S as follows:

f(x1, x2, … xn) = True iff f(xi, xj) = True ∀ 1 ≤ i ≤ n ∀ 1 ≤ j ≤ n, n > 1, else False.

f(a, b) is known and f(a, a) is True ∀ a, b in S.

I would appreciate some help in designing a fast algorithm that can return all subsets of S upon which f returns True.

As an example, let S = [a, b, c] and f(a, b) = f(b, c) = f(a, c) = True. The algorithm should then return [[a, b], [a, c], [b, c], [a, b, c]].

I have thought of four strategies to improve on brute force search:

1) The order of parameters of f doesn’t matter.

2) Use the fact that f(a, a) is True and f(xi, xj) = f(xj, xi) so only i < j needs checking.

2) Use the fact that f(x1, x2, … xn+1) = f(x1, x2, … xn) ∧ (f(xi, xn+1) ∀ 1 ≤ i ≤ n) where ∀ denotes iterated conjunction.

3) note that 2) implies that if f(x1, x2, … xn) returns False, then f(x1, x2, … xn+Δ) also does, potentially reducing the solution space.

4) Returning False as soon as soon as f(xi, xj) is false for some i, j.

If you want to write some code, I would appreciate it if you could give it in python.

Many thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T22:27:48+00:00Added an answer on June 6, 2026 at 10:27 pm

    The two-argument function f(a, b) can be seen as a symmetric, reflexive relation on S, which can be seen as an undirected graph.

    Viewed that way, f(x1, ..., xn) is true iff {x1, ..., xn} forms a complete subgraph.

    From there, you end up at the clique problem which, unfortunately, turns out to be NP-complete. In other words, a fast algorithm is unlikely to exist.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my init I have set some variables and one animate that uses those
trying to display data only after variables have been set. $(document).ready(function () { function
I have set my default-input-method variable to english-dvorak: (custom-set-variables '(default-input-method english-dvorak)) When I launch
I am currently in C# and I have set Session variables on each page.
I have the following lines in my ~/.emacs.d/init.el (custom-set-variables '(flymake-allowed-file-name-masks (quote ( (\\.cc\\' flymake-simple-make-init)
CGI scripts should have access to a list of environment variables set by the
On Ubuntu Linux, with Bash, I have /etc/profile set with read-only variables on login.
I have a script to get and set user's Windows environment variables on other
Looking to have a database query set all the instance variables in a class:
If I have boolean variables a_1, a_2, .. , a_n. How can I express

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.