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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:48:44+00:00 2026-06-13T21:48:44+00:00

I have a need to develop an algorithm that will take a set of

  • 0

I have a need to develop an algorithm that will take a set of unordered objects and re-order them intelligently based on the objects they are allowed to proceed to.

My initial design/thought is to use Core Data to store an entity (for instance “Objects”) with a to-many relationship (“canGoTo”) back on itself with a set of objects that can follow the selected Objects *object.

Consider the following example where each object has a set of objects in which it can proceed to (the actual set of objects is much larger).

Object A - can go to -> Objects B,C,D
Object B - can go to -> Objects E,F,G,Y,H
Object C - can go to -> Objects P,S,Z
Object D - can go to -> Objects H,J,X
...
Object G - can go to -> Objects R,Y,Z
Object H - can go to -> Objects G,Z
...
Object Y - can go to -> Objects Z
Object Z - can go to -> Objects NULL (no objects follow this object)

If the program is given a set of Objects (R,B,H,G,A,Z) the program needs to find how to re-order the objects to find an acceptable structure. Thus the correct outcome for this set would be A->B->H->G->Y->Z

What strategy is the best, or most efficient, to flow through this issue? Should I be looping through re-orders and quitting when I successfully touch all objects in a pass? Using a genetic algorithm to generate output and analyzing generations (i.e. http://ijoshsmith.com/2012/04/08/simple-genetic-algorithm-in-objective-c/)? Or do I use an Insertion Sort to analyze all objects and re-order the object to where it can fit in the sequence? Keep in mind the real list of objects will be more like 30+ objects long instead of 6, and in a perfect world the program would pick the BEST way to order the list (maybe based on “canGoTo” priority).

Any advice/best practices would be greatly appreciated. Sorry for no sample code, this is in the thought phase at the moment.

  • 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-13T21:48:45+00:00Added an answer on June 13, 2026 at 9:48 pm

    You can model your problem as a Directed Acyclic Graph and then do Topological Sorting on it. This will give the exact output you are looking for.

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

Sidebar

Related Questions

I have to develop a table that would contain distance between destinations and need
need help regarding USSD Gateway. I have to develop an app, which will directly
We have a requirement where we need to develop a webservice client based upon
I need to develop an app that is using multithreading. Basicly, I have a
I need to develop a dashboard that will be displayed in a flat screen
I need to develop a windows application with .NET 3.5 that needs to have
I have an existing website that I need to develop a small portion of
I have to develop an algorithm for location based data grabbing and displaying it
I need to develop a lightweight web application, it will: have a simple webgui
I need to develop a CRM system which will allow users to have a

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.