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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:20:21+00:00 2026-05-27T12:20:21+00:00

Update 2011-12-28: Here’s a blog post with a less vague description of the problem

  • 0

Update 2011-12-28: Here’s a blog post with a less vague description of the problem I was trying to solve, my work on it, and my current solution: Watching Every MLB Team Play A Game


I’m trying to solve a kind of strange pathfinding challenge. I have an acyclic directional graph, and every edge has a distance value. And I want to find a shortest path. Simple, right? Well, there are a couple of reasons I can’t just use Dijkstra’s or A*.

  1. I don’t care at all what the starting node of my path is, nor the ending node. I just need a path that includes exactly 10 nodes. But:
  2. Each node has an attribute, let’s say it’s color. Each node has one of 20 different possible colors.
  3. The path I’m trying to find is the shortest path with exactly 10 nodes, where each node is a different color. I don’t want any of the nodes in my path to have the same color as any other node.
  4. It’d be nice to be able to force my path to have one value for one of the attributes (“at least one node must be blue”, for instance), but that’s not really necessary.

This is a simplified example. My full data set actually has three different attributes for each node that must all be unique, and I have 2k+ nodes each with an average of 35 outgoing edges. Since getting a perfect “shortest path” may be exponential or factorial time, an exhaustive search is really not an option. What I’m really looking for is some approximation of a “good path” that meets the criterion under #3.

Can anyone point me towards an algorithm that I might be able to use (even modified)?


Some stats on my full data set:

  • Total nodes: 2430
  • Total edges: 86524
  • Nodes with no incoming edges: 19
  • Nodes with no outgoing edges: 32
  • Most outgoing edges: 42
  • Average edges per node: 35.6 (in each direction)
  • Due to the nature of the data, I know that the graph is acyclic
  • And in the full data set, I’m looking for a path of length 15, not 10
  • 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-27T12:20:22+00:00Added an answer on May 27, 2026 at 12:20 pm

    It is the case when the question actually contains most of the answer.

    Do a breadth-first search starting from all root nodes. When the number of parallelly searched paths exceeds some limit, drop the longest paths. Path length may be weighed: last edges may have weight 10, edges passed 9 hops ago – weight 1. Also it is possible to assign lesser weight to all paths having the preferred attribute or paths going through the weakly connected nodes. Store last 10 nodes in the path to the hash table to avoid duplication. And keep somewhere the minimum sum of the last 9 edge lengths along with the shortest path.

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

Sidebar

Related Questions

UPDATE 07/12/2011: I figured it out. Will post solution as soon as I'm finished
Update 2011-05-20 12:49AM: The foreach is still 25% faster than the parallel solution for
[UPDATE] Was just an idiot mistake. See end for solution. I am trying to
Here's my query: UPDATE lynn_mis_goodsales SET accepteddate = '2011-02-30 13:24:50' WHERE created LIKE '0000-00-00
UPDATE 2011.09.13 This bug has been resolved by Adobe. The example code below now
I am using Visual studio 2011 beta with the april 2012 update installed .I
Update: Is there a way to achieve what I'm trying to do in an
I'm using a chart taken from here http://writerbay.wordpress.com/2011/03/12/android-tutorial-displaying-chart-on-android/#comment-54 to draw a graph in android.
Here is some code from the CRUDOperations.vb file in Microsoft Dynamics CRM 2011 SDK:
I'm trying to save date (using C# official driver): val = DateTime.Parse(value).Date; //Here date

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.