Is it possible to get back results from a Traverser step in ArangoDB / Foxx service?
I'm looking to implement ohmic resistance calculations on a power grid graph. Herein I traverse BFS (breadth-first) down the graphs' edges to it's leafs. - No problem. Using Filters, Expanders and Visitors is just fine!
My interest is to perform 1/x
calculations for each line at a branching node / step to solve parallel resistance when coming "back to the root / top" of the graph.
So, my question is: "Is it possible to get a return value from each step?" - If yes where can I specify calculate the return value?
Thanks for any hints!
UPDATE 2017-12-21: Further explanation
Here's an image of a Demo Graph of my case: Image of the Demo Graph Explanation of the image: * The "black" values are the raw ohmic values for the calculation (e.g. weight of the edge in a weighted graph). * The "red" values are calculated ohmic values (subresults) for each step.
CSV Data of the Graph:
- Nodes:
"_key","stationId","voltage","voltageKey","pathId","elementId","type","typeKey","name","status","oStatus","isSource","sourceColor","isStrandSource","isStrandEnd","strandSourceColor" "NE-2_J_1","2","20","J","","1","conn","","root","1","1","","","","","" "NE-2_J_2","2","20","J","","2","conn","","Abzweig 1","1","1","","","","","" "NE-2_J_3","2","20","J","","3","conn","","Abzweig 2","1","1","","","","","" "NE-2_J_4","2","20","J","","4","conn","","Abzweig 3","1","1","","","","","" "NE-2_J_5","2","21","J","","5","conn","","Abzweig 4","1","1","","","","","" "NE-2_J_6","2","22","J","","6","conn","","Abzweig 5","1","1","","","","","" "NE-2_J_7","2","23","J","","7","conn","","Abzweig 6","1","1","","","","","" "NE-2_J_8","2","24","J","","8","conn","","Abzweig 7","1","1","","","","",""
- Edges:
"_key","_from","_to","elementId","type","typeKey","voltage","voltageKey","name", "status","oStatus","xOhm" "NE-J19","NE-2_J_1","NE-2_J_2","19","solid","","20","J","","1","1","1" "NE-J20","NE-2_J_2","NE-2_J_3","20","solid","","20","J","","1","1","2" "NE-J21","NE-2_J_2","NE-2_J_4","21","solid","","20","J","","1","1","3" "NE-J22","NE-2_J_3","NE-2_J_5","22","solid","","20","J","","1","1","4" "NE-J23","NE-2_J_3","NE-2_J_6","23","solid","","20","J","","1","1","5" "NE-J24","NE-2_J_4","NE-2_J_7","24","solid","","20","J","","1","1","6" "NE-J25","NE-2_J_4","NE-2_J_8","25","solid","","20","J","","1","1","7"
Explanation of the calculation:
The calculation is performed "bottom up" so my intention was to handle the math after the traverser "returns" the result from the underlying graph.
Step 1: Calculate the resulting (parallel) resistance of the "bottom left" branch ("NE-2_J_5" AND "NE-2_J6") at "NE-2_J_3":
- The math for this is
1 / ( 1/4 Ohm + 1/5 Ohm ) = 2,22 Ohm
- The math for this is
Step 2: Calculate the resulting (parallel) resistance of the "bottom right" branch ("NE-2_J_7" AND "NE-2_J_8") at "NE-2_J_4":
- The math for this is
1 / ( 1/6 Ohm + 1/7 Ohm ) = 3,23 Ohm
- The math for this is
Step 3: Calculate the resulting (inline) resistance of the "bottom left" branch ("NE-2_J_3 raw" value AND "NE-2_J_3 calculated") before calculating Step 5:
- The math for this is
2 Ohm + 2,22 Ohm = 4,22 Ohm
- The math for this is
Step 4: Calculate the resulting (inline) resistance of the "bottom right" branch ("NE-2_J_4 raw" value AND "NE-2_J_4 calculated") before calculating Step 5:
- The math for this is
3 Ohm + 3,23 Ohm = 6,23 Ohm
- The math for this is
Step 5: Calculate the resulting (parallel) resistance of the "center" branch (Step 3 AND Step 4) at "NE-2_J_2":
- The math for this is
1 / ( 1/4,22 Ohm + 1/6,23 Ohm ) = 2,52 Ohm
- The math for this is
Step 6: Calculate the resulting (inline) resistance of the "center" branch ("NE-2_J_2 raw" value AND "NE-2_J_2 calculated") for the final result at "NE-2_J_1":
- The math for this is
1 Ohm + 2,52 Ohm = 3,52 Ohm
- The math for this is