0

I working on a simple water pipeline path modelling and listing each path.

The model is simple because the pipes do not create loops or grids. It consists of nodes which are representing the edge of each pipe segment. Based on this we can say it is similar to a Binary Tree data model. However, as I understand, trees are hierarchical data structures. And also, I see on https://www.geeksforgeeks.org/print-root-leaf-path-without-using-recursion/?ref=lbp that, data is defined with left-right-left.left etc, by describing the exact location of each node. In my case, the data should include only the start and end nodes for each pipe segment. Each node should also include info if it is the source (root) or leaf node. Number of leaf nodes will be equal to number of paths. My model does not require any hierarchy and also it does not require left-right definition. In this case we may say it is similar to a Graph, but my model also does not have loops or grids.

So please advise how to model this and create an algorithm.

Tim O.
  • 15
  • 7
  • Does the water always flow in the same direction ? If so, your graph is a forest. If it also has a single root, then it is a tree. If the water can flow both ways, it is an acyclic graph. What king of computations do you want to do with your graph ? – gchapuis May 09 '22 at 09:23
  • Water always flows from the root to the leaves. The objective is to find out the critical path where the total pressure drop within the path is the highest among the other paths but also listing out rest of the paths for the user as a reference. Please see my other post for the current data structure https://stackoverflow.com/q/72127111/10507528 – Tim O. May 09 '22 at 09:34
  • You should have a look at this post https://stackoverflow.com/questions/107660/how-to-compute-the-critical-path-of-a-directional-acyclic-graph and the links they give – gchapuis May 09 '22 at 14:03
  • @gchapuis thank you. I think these [link](https://stackoverflow.com/q/444296/10507528) [link](https://stackoverflow.com/q/58306/10507528) are very close to the solution however not exactly what I need. I created another question, I believe I am more clear [there](https://stackoverflow.com/q/72173779/10507528). – Tim O. May 09 '22 at 19:28

0 Answers0