Drawing a calculation as a DAG node graph
A spreadsheet links calculations by cell address. A node graph turns values and operations into boxes and connects them with wires. The reason the second is worth the effort is that when a number looks wrong, the box to doubt is on the screen.
What a DAG is
DAG stands for directed acyclic graph. Directed means every wire has a start and an end; acyclic means that however far you follow the wires, you never arrive back where you started.
A calculation graph has to be a DAG for a simple reason: if a value is used to compute itself, it never becomes defined. If next year's balance were defined as next year's balance plus interest, the calculation could not begin. Acyclicity is the guarantee that it finishes.
The FlowSim canvas enforces that. Before a wire is created, the app checks whether it would close a loop and refuses if it would.
Choosing node types
Nodes fall into three groups: inputs that create values (constants, sliders), calculations that transform them (operations, branches, sums, series), and outputs that display them. The distinction matters because whatever you make a slider is what you can shake.
Make the values you change often sliders and the structural values constants. In the wealth template the return and the monthly contribution are sliders while the 240-month horizon is a constant. If the horizon were a slider, the sensitivity pass would move it by 20% and blur the effect of the return you actually wanted to study.
Wiring rules
Wires always run from an output to an input. An input port accepts one wire; an output can feed many. Because of that rule each node's value depends only on its inputs, and no node needs computing twice.
Moving a node never changes a value: position is for the reader, the calculation reads only the wires. Changing a wire, on the other hand, recomputes everything downstream of it. When you edit a graph, check the wires before the layout.
When the graph grows
Past twenty nodes the canvas gets busy. Keep the flow left to right and stack nodes of the same stage vertically; FlowSim lays templates out that way automatically by computing dependency depth.
Names matter more than you think. "After-tax value" beats "Operation 3". When you reopen a saved JSON months later, the names are the documentation.
{
"app": "flowsim",
"version": 1,
"nodes": [
{"id": "n1", "type": "slider", "title": "Monthly contribution", "params": {"value": 500000}},
{"id": "n2", "type": "series", "title": "Balance", "params": {"periods": 240}}
],
"edges": [{"from": "n1", "to": "n2", "port": "add"}]
}
When it is worth it
A node graph pays off when the same calculation repeats, when one value feeds several places, or when you need to test assumptions. It is overkill for a single line: one interest calculation is faster on a calculator than in five nodes.
The test is "who uses this number". If a value is used in two places, lift it into its own node, because then the wires show what moves with it.
| Node type | Role | Typical use |
|---|---|---|
| Constant | a value that does not change | period count, square-root exponent, unit factor |
| Slider | a value you change often | interest rate, monthly contribution, churn |
| Series / compound | builds a value per period | savings balance, customer count, price index |
| Operation | adds, subtracts, multiplies, divides | principal, after-tax amount, apparent power |
| Branch | picks a value by condition | A if the fund beats the target, else B |
| Sum | combines several inputs | revenue across channels |
| Output chart | draws the result | monthly balance, cumulative saving |
Questions
Does a calculation fail without a DAG?
You can still compute parts of it, but a node inside a cycle has no defined value. FlowSim detects the cycle, computes the rest, and marks the nodes it could not compute.
How many nodes can I use?
Dozens are fine for display and computation. Beyond thirty on one screen it becomes hard to read, so fold repeated groups into a single series node.
Sources
Every calculation here can be reproduced with a template in the simulator.
Open the simulator