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 8398373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:02:27+00:00 2026-06-09T21:02:27+00:00

I have a smallish, complex database (a few millions of records split over very

  • 0

I have a smallish, complex database (a few millions of records split over very low thousands of tables). The records can be thought of as business rules. There is provision for users to define their own rules, in terms of existing rules (including other user defined rules). These rules are dependent on other rules, sometimes via complex paths. The dependencies form an extended network, rather than a hierarchy.

I am looking for an algorithm to determine, in a newly defined rule (or set of rules) whether the new rule is itself cyclic, or whether it creates cycles when taken together with existing rules.

I need an algorithm that is efficient in the following circumstances:

  1. The result of the algorithm needs only to be a boolean – true if there is a cycle, false otherwise.
  2. The existing database can be assumed to be cycle free.
  3. Processing can stop as soon as a cycle is found. The usual case (95% ??) will be that there is no cycle. Unfortunately, this is precisely the case where (I think) processing will have to complete all possible paths for the proposed new rule, in order to determine there is no cycle.
  4. This algorithm is to be used to validate new user defined rules, as they are entered into the database. It needs to be as quick as possible for the usual case – I don’t want this validation to become a bottleneck in the creation process.
  5. Obtaining data is comparatively expensive – usually involving one or more queries, some of which are quite complex. The newly defined rule set can be constrained so as to be completely available in memory. If there are any other constraints that can be imposed on the input of new rules, that will aid the efficiency of this checking, I am not aware of what they may be.

EDIT

I am accepting Nick’s answer, with one modification. Storing the dependencies is a very easy modification to the database. I am only going to store the direct dependencies rather than all dependencies whether direct or indirect. I can view the two sets of dependency C,D,F,G and X,Y,Z (in Nick’s answer) as tree structures, and use one of the various techniques for deriving hierarchical structures from a single level dependency table. I think the cost of this will be acceptable in this context.

EDIT

  • 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-09T21:02:28+00:00Added an answer on June 9, 2026 at 9:02 pm

    I hope I understood your problem correctly:

    Lets assume you add rule A to the database, then you also add dependency information like A depends on C,D,F,G and X,Y,Z depend on A.

    I would assume there is no way of detecting a cycle at insertion time without really looking at the whole structure, which you say is disallowed.

    So my idea would be to have everything precomputed and stored, i.e. for each rule R store all other rules it depends on (not only directly, but also indirectly). Now when you insert rule A simply get all dependencies from C, D, F, G and see if they include any of X,Y,Z or A if they don’t there is no cycle and you can safely add A to your ruleset and store all the dependencies from C, D, F, G plus C, D, F, G themselves as A’s dependecies.

    This of course requires some restructuring (and rebuilding) of the database.

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

Sidebar

Related Questions

I have a smallish utility library I made that I had created in TFS
Have 2 tables in Access 2007, both lists of certain tasks to be accomplished.
I have a smallish number (2-10) of largeish files (6-15GB) that compress really well
Have searched the database but need to specifically sum(of hours flown or days off)in
I have smallish personal project consisting of the following Eclipse workspace. + +-MyApp //
We have a smallish C++ Linux project that accompanies our large C++/MFC Windows project.
I am trying to build a smallish haskell app that will translate a few
I have a query that is giving me problems and I can't understand why
Have one Doubt In MVC Architecture we can able to pass data from Controller
I have a vb script that processes text files on a server, however, very

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.