0

Hello! I have a networkX graph of skeleton of inner space in porous structure. I need to calculate lengths of paths between the inlet and outlet nodes. In order to do it I consider nodes with z coordinate more/less than certain number (lower and upper black lines) and if they has paths between each other I calculate them. But with that approach I calculate almost the same paths several times because I don't know how to define only inlet (or outlet).

I consider all the nodes lower and upper black lines

Andrey
  • 15
  • 4

1 Answers1

1

Would it not be enough to

  • grab a list of possible inlet nodes (z>450)
  • grab a list of possible outlet nodes (z<50)
  • compute all the combinations of input/output nodes (itertools.product) and stash them into a dict mapping pairs to paths (dict.fromkeys(combinations, None))
  • for each combination:
AKX
  • 152,115
  • 15
  • 115
  • 172
  • 1
    I would just add to this that inlet and outlet node candidates furthermore have the property that they have a node degree of 1 (i.e. they are a leaf in the graph) -- accessible via `nx.Graph.degree`. – Paul Brodersen Feb 28 '20 at 10:50
  • I did the combinations feature and it worked for me! Also thank you for node degree information, I didn't know about it. – Andrey Mar 03 '20 at 13:23