I am working on a graph problem which is special in the sense that the nodes are computed only when required. This is because the graph is so huge that the entire graph won't fit in memory.
So, in my code I only have a node class and a computeChildren() method which gets called only when needed. I also have certain global parameters which are to be computed when the initNode is initialized. I am trying to figure out the best way to store these parameters. I thought about updating the parameters in the init method of the class but this causes the same computations to be repeated whenever a new node is computed.
I am using python3, could someone please suggest the right way to do this ...
UPD: The values used to initialize the init node decide the graph structure, this information is same for all nodes.
Some details regarding my coding background : I have mostly coded in C with some limited expertise in C++.