How node-red execute nodes in a flow?

Node-red is amazing tool for programming. I really want to know deeply about it. But, JavaScript is not really my familiar programming language.

I am wondering how node-red save all the node inside a flow (I mean, which data structure did they used? It like a tree, but not really a tree, is it graph?) And after user press the "Deploy", which order keep all the node running, how it pass the pre-node parameter to another one?

I cloned the code, but as I has mention above, I am not good at JavaScript, so can anyone point me out which function should I take a look?

The flows are stored in a json file and can be found in the ~/.node-red directory as 'flows.json'
All the properties (x,y, parameters of the nodes, its wire connections) are stored in there.

This is not as easy as copying some function.

Which code? We don't really have enough information here to help you.

Generally, you don't need to concern yourself with the mechanics of Node-RED other than the basics. If you make a change, you need to deploy. That writes the changes to the appropriate files and restarts any sections of the flow that it needs to.

There are different types of deploy, the default forces all flows to restart. The others limit the restart which is useful because not everything in memory then gets reset.

The mechanics of how this works is interesting to some of us, especially those of us creating nodes, but mostly you rarely need to understand it.