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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:00:41+00:00 2026-05-27T21:00:41+00:00

I asked a question about finding subsequences in a variable amount of sets with

  • 0

I asked a question about finding subsequences in a variable amount of sets with no repeating characters. The solution was to create a matrix of each pair of letters, discard those that don’t occur in each set, and then find the longest path in the directed acyclic graph. However, I don’t want just the longest path, I want several of the longest paths (e.g. if it generates subsequences of lengths 10, 10, 9, 8, 8, 3, 3, 2, and 1, I may want to display the first 5 subsequences only).

And so, since I’m not looking for only the longest path, in order to generate the resulting subsequences, rather than using the longest path algorithm described in the wikipedia article, I’m using a naive algorithm which simply generates a list of all possible subsequences. This generates a set similar to the results in an answer to my previous question.

The problem is that I want to reduce the amount of subsequences it is generating.

For example, if I have the following sets:

A = AB12034
B = BA01234
C = AB01234

… my algorithm will currently come up with the following pairs that occur in each set:

A - 1     B - 1     1 - 2     2 - 3     0 - 3     3 - 4
    2         2         3         4         4
    3         3         4
    4         4
    0         0

This is technically correct, but I would like to eliminate some of these pairs. For example, notice that 2 always comes after 1. Therefore, I would like to eliminate the A2 and B2 pairs (i.e. A and B should never jump directly to 2… they should always go through 1 first). Also, 1 should never jump to any number besides 2, since 2 always occurs immediately after it. Furthermore, notice how 0 always occurs between B and 3, so I would like to eliminate the pair B3 (again, B should always go through 0 before it jumps to 3, since all sets have the positions of these three letters as: B < 0 < 3).

Just to be clear, the current algorithm will come up with these subsequences: (I included only those which begin with A for brevity):

A1234
A124  *
A134  *
A14   *
A234  *
A24   *
A34   *
A4    *
A034
A04   *

… and all those marked with * should be eliminated.

The (correct) pairs which generate the desired subsequences would be:

A - 1     B - 1     1 - 2     2 - 3     0 - 3     3 - 4
    0         0                           

… and the complete list of subsequences would be:

A1234
A034
B1234
B034
1234
234
034
34

In other words, I’m trying to go from this directed acyclic graph:

enter image description here

To this:

enter image description here

What sort of algorithm/logic should I use in order to get rid of these extraneous pairs (i.e. graph edges)? Or do you think that my logic in generating the pairs in the first place is the thing that should be changed?

  • 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-27T21:00:41+00:00Added an answer on May 27, 2026 at 9:00 pm

    Furthermore, notice how 0 always occurs between B and 3, so I would like to eliminate the pair B3 (again, B should always go through 0 before it jumps to 3, since all sets have the positions of these three letters as: B < 0 < 3).

    Hmm, okay so if n0 < n1 < n2 holds on all sets then remove all (n0, n2) pairs? This can be achieved with this (in pseudoPython):

    for(edge in node):
        if(len(LongestPath(node, edge.Node)) > 1):
            RemovePair(node, edge.Node)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently asked a question about Oracle Encryption. Along the way to finding a
i asked the question about haw to create a button by a text &
I initially asked a question about how to create linux users via HTML (essentially
Krumelur asked this question about how create a recipient bubble similar to the mail.app.
Somebody asked a question about how to create a web service (as opposed to
Just asked a question about linking Boost libraries in the make file. Thanks to
I asked a question about building custom Thread Safe Generic List now I am
I asked a question about different testing frameworks yesterday. This question can be found
I asked a question about Garbage Collection in Java in this topic . But
I recently asked a question about IIf vs. If and found out that there

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.