Click here to Skip to main content
15,889,315 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: A* & Genetic Algorithms Pin
73Zeppelin28-Dec-08 7:41
73Zeppelin28-Dec-08 7:41 
GeneralRe: A* & Genetic Algorithms Pin
Mustafa Ismail Mustafa28-Dec-08 8:16
Mustafa Ismail Mustafa28-Dec-08 8:16 
GeneralRe: A* & Genetic Algorithms Pin
73Zeppelin28-Dec-08 20:45
73Zeppelin28-Dec-08 20:45 
GeneralRe: A* & Genetic Algorithms Pin
Mustafa Ismail Mustafa28-Dec-08 20:49
Mustafa Ismail Mustafa28-Dec-08 20:49 
Jokeurgent! Pin
Mark Churchill24-Dec-08 23:25
Mark Churchill24-Dec-08 23:25 
GeneralRe: urgent! Pin
73Zeppelin28-Dec-08 5:29
73Zeppelin28-Dec-08 5:29 
Questionmpeg 2 sync ( & a little hardware ) Pin
bulg24-Dec-08 8:20
bulg24-Dec-08 8:20 
QuestionCalculating the longest path Pin
zenerguy3223-Dec-08 20:15
zenerguy3223-Dec-08 20:15 
I have a problem I can't seem to figure out. I'm trying to code an algorithm which calculates the longest path(s) from a given list of nodes and their neighbor nodes. I've learned a little bit about Djikstra's and the "traveling salesman" algorithms but those are both meant to calculate the shortest distance between two points. The problem statement would basically be "Given a list of nodes and their neighboring nodes (all one unit away), calculate the longest path(s) that can be taken using any given 'segment' only once in each path."

Here's an example. Given this list:

Node : Neighboring Node,Neighboring Node,Neighboring Node
0 : 1,2,9
1 : 0,5,6
2 : 0,3,-1
3 : 2,4,-1
4 : 3,5,-1
5 : 4,1,-1
6 : 1,7,-1
7 : 6,8,-1
8 : 7,9,-1
9 : 8,0,-1
('-1' means no neighboring node)

the algorithm should output:

"0-1-5-4-3-2-0-9-8-7-6-1"
"0-1-6-7-8-9-0-2-3-4-5-1"
"0-2-3-4-5-1-0-9-8-7-6-1"
"0-2-3-4-5-1-6-7-8-9-0-1"
"0-9-8-7-6-1-0-2-3-4-5-1"
"0-9-8-7-6-1-5-4-3-2-0-1"
"1-0-2-3-4-5-1-6-7-8-9-0"
"1-0-9-8-7-6-1-5-4-3-2-0"
"1-5-4-3-2-0-1-6-7-8-9-0"
"1-5-4-3-2-0-9-8-7-6-1-0"
"1-6-7-8-9-0-1-5-4-3-2-0"
"1-6-7-8-9-0-2-3-4-5-1-0"

I've been trying to code this in VB6 but it's gotten very messy and I think I'd like to try coding it in Python to get it working and then convert it to VB6.

My current method starts at a node and "jumps" to a neighbor node until it reaches a node that's already been used once in the current path, and then jumps backwards until it reaches a three-neighbor-node and takes the second "fork" of that node until it reaches that end. It does this until it's jumped all the way back to the starting node, and then it chooses another starting node and runs again until all three-neighbor nodes have been started from. I guess it's similar to a tree-searching algorithm except the branches can connect to each other.

I've spent a while Googling and haven't found much - most articles I've found deal with finding the shortest path. Any help would be appreciated!
AnswerRe: Calculating the longest path Pin
73Zeppelin28-Dec-08 5:13
73Zeppelin28-Dec-08 5:13 
GeneralRe: Calculating the longest path Pin
zenerguy3230-Dec-08 10:04
zenerguy3230-Dec-08 10:04 
GeneralRe: Calculating the longest path Pin
73Zeppelin31-Dec-08 2:07
73Zeppelin31-Dec-08 2:07 
GeneralRe: Calculating the longest path Pin
zenerguy3231-Dec-08 7:24
zenerguy3231-Dec-08 7:24 
Questiontext diff Pin
m-khansari21-Dec-08 19:55
m-khansari21-Dec-08 19:55 
AnswerRe: text diff Pin
73Zeppelin22-Dec-08 6:08
73Zeppelin22-Dec-08 6:08 
GeneralRe: text diff Pin
m-khansari24-Dec-08 22:55
m-khansari24-Dec-08 22:55 
QuestionRadian angle to Quaternion Pin
shaibee18-Dec-08 3:29
shaibee18-Dec-08 3:29 
AnswerRe: Radian angle to Quaternion Pin
73Zeppelin18-Dec-08 3:42
73Zeppelin18-Dec-08 3:42 
GeneralRe: Radian angle to Quaternion Pin
shaibee18-Dec-08 4:01
shaibee18-Dec-08 4:01 
GeneralRe: Radian angle to Quaternion Pin
73Zeppelin18-Dec-08 4:48
73Zeppelin18-Dec-08 4:48 
QuestionPseudocode implementation of the strict timestamp protocol for ensuring serializability, recoverability and cascadeless roll-backs [modified] Pin
efgtdg17-Dec-08 10:07
efgtdg17-Dec-08 10:07 
AnswerRe: Pseudocode implementation of the strict timestamp protocol for ensuring serializability, recoverability and cascadeless roll-backs Pin
73Zeppelin17-Dec-08 22:17
73Zeppelin17-Dec-08 22:17 
GeneralRe: Pseudocode implementation of the strict timestamp protocol for ensuring serializability, recoverability and cascadeless roll-backs Pin
efgtdg18-Dec-08 0:39
efgtdg18-Dec-08 0:39 
GeneralRe: Pseudocode implementation of the strict timestamp protocol for ensuring serializability, recoverability and cascadeless roll-backs Pin
73Zeppelin18-Dec-08 2:00
73Zeppelin18-Dec-08 2:00 
GeneralRe: Pseudocode implementation of the strict timestamp protocol for ensuring serializability, recoverability and cascadeless roll-backs Pin
efgtdg19-Dec-08 0:51
efgtdg19-Dec-08 0:51 
GeneralRe: Pseudocode implementation of the strict timestamp protocol for ensuring serializability, recoverability and cascadeless roll-backs Pin
73Zeppelin19-Dec-08 2:30
73Zeppelin19-Dec-08 2:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.