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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:51:56+00:00 2026-05-30T16:51:56+00:00

We have a rule that disallows cyclic dependencies between packages. We also have a

  • 0

We have a rule that disallows cyclic dependencies between packages.

We also have a rather huge package that needs some splitting.

The question is: How can I identify a/all/maximum subset of classes, that can be extracted from the package into a new package without creating a cyclic dependency.

Is there a well known algorithm for that?

A variation would be awesome in which on can define a maximum number of dependencies that can be ignored by the algorithm.

Rather obviously the subset(s) should be not identical to the package, nor empty.
In case of a maximum subset it should be smaller than one half of the original package.

  • 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-05-30T16:51:57+00:00Added an answer on May 30, 2026 at 4:51 pm

    Basically, your classes, objects, or what have you, are stored in a matrix (called adjacency matrix) that represents a directed graph (with or without cycles). See the graph below and the corresponding adjacency matrix.

    enter image description here

    From this, we can calculate the reachability matrix, which describes to which nodes can one travel from the current node. For this graph, the reachability matrix is

    enter image description here

    You need an algorithm that rearranges the rows and the columns of the matrix, so that all non-zero elements are below the main diagonal. A sequence of object indexes for which this is true can be executed in the order in which they appear in the matrix, and all necessary dependencies for each object would be satisfied. If the graph is known to be acyclic, this can be achieved by topological sorting.

    When cycles appear in the directed graph, you won’t be able to find an ordering for which this is true.

    Enter Design/Dependency Structure Matrix (DSM). A so called partitioning algorithm can be implemented to divide the objects into levels. For each of those levels, the objects can be executed in arbitrary order, and are not dependent one or another. For the graph above, nodes 3, 4 and 5 are not dependent on each other and can be executed in any order.

    A partitioning algorithm has been developed in (Warfield 1973), which is able to detect and isolate cycles in the DSM. This is similar to the topological sorting algorithm, but with usage of the reachability matrix to detect and isolate cycles.

    The algorithm briefly:

    1. Create a new partition level
    2. Calculate the reachability and the antecedent sets R(s) and A(s)
    3. For each element in the DSM, calculate the set product R(s)A(s)
    4. If R(s)A(s)=R(s), then add the element s to the current level
    5. Remove element s from the list, and all references to it from the reachability and antecedent sets of all other elements.
    6. Repeat from 1 if the item list is not empty.

    The antecedent set A(s) is the set of row indices of non-zero elements in column s, while the reachability set R(s) is the set of column indices of the non-zero elements of s.

    Finally, some pseudocode (in VB.NET, no less):

    CalculateInitialAntecedentSets()
    CalculateInitialReachabilitySets()
    While UnlabelledItems > 0
        Sequence.AddNewPartitionLevel()
        For Each s In ReachabilityMatrix
            If NoDependencies(s) and AlreadyConsidered(s) Then
                AddToLevel(CurrentLevel, s)
            End If
        Next
    
        RemoveDependencies(ReachabilitySets, Sequence.Level(CurrentLevel))
        RemoveDependencies(AntecedentSets, Sequence.Level(CurrentLevel))
    
        UpdateConsideredList(Sequence.Level(CurrentLevel))
        Unlabelled = Unlabelled - Sequence.Level(CurrentLevel).Count
        CurrentLevel = CurrentLevel + 1
    End While
    

    (This was the topic of my Master thesis some years ago)


    Warfield, John N. (1973), `Binary matrices in system modelling’, IEEE Transactions on Systems, Man, and Cybernetics SMC-3(5), 441–449.

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

Sidebar

Related Questions

I have a table that defines the rule between two variants: CREATE TABLE VARIANTCOMBINATIONRULE
I have a mod_rewrite rule that will send any subdomain requests to a php
I have a rule, that gets up to three parts, separated by a /
One CSS rule I have learned is that you should use the relative em
With at-rules, it's possible to have a ruleset for elements during that at-rule event
I have a website that employs a generic mod_rewrite rule to push all requests
Anyone have a good rule of thumb for choosing between different implementations of Java
In my CSS I have a rule that must be applied to all text
In my GNUmakefile, I would like to have a rule that uses a temporary
i have got below rule that works fine with standart domain names like .net.com,.mobi

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.