So... I have the following:
A class with several properties which are retrieved from an .xml file. These properties are if the object is a condition (it has two children) and its name. Basically, the object's children properties are the names of its children.
The .xml looks like this:
<object-2>
<name>Object - 2</name>
<yesChild>Object - 3</yesChild>
<noChild>Object - 4</noChild>
</object-2>
If the noChild is empty, then it means that the object is not a condition. All objects retrieved from the .xml are stored into an array.
What I need is to somehow create a tree out of it and identify all paths that can be taken in order to reach the last element in the array. The algorithm does not need to traverse all nodes, just the ones it needs to reach the last element of the array.
Example:
We have 4 objects: X1, X2, X3 and X4, where X1 is a condition with X2 and X3 as its children then we will have 2 paths that start in X1 and end in X4. Path 1: X1->X2->X4 Path 2: X1->X3->X4
Thank you.