Hi,
I am currently developing a program in C++ which detects path to super node from a simple node in a ring type topology. My requirement is that I need to traverse from simple node to super node and highlight all the possible paths which are going to super node. This includes ring topology in between super node and simple node.

I would like to write a recursive function to find the path. Please let me know if anyone has any idea about how to develop recursive function which detects it. I have developed the function but it fails in curtain senarios. I have attached the images for more understanding.

Recommended Answers

All 2 Replies

Member Avatar for iamthwee

Well where is your code??

Are you using a linked list?

Post some code.

I am not using any linked list. I am using following code

ShowConnections(EndNode EndID, PreviousConnected ID)
{
this->GetConnectedObjects(arrConnectedObject);

for (nConnectedPorts = 0; nConnectedPorts < arrConnectedObject.GetSize();nConnectedPorts++)
{
lDataModId = this->myID;
if ( lDataModId == EndID)
{
//Show green Color line
return true;
}
else
{
ShowConnections(EndID,lDataModId )
{
//Show green color line
return true;
}
}
}
return false;
}

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.