Open WilliamMcCumstie opened 5 years ago
Now that all the dependencies have been identified, they now need to be put into order. This requires preforming a topological sort on the above returned list. The problem with the above example is there is a cyclic loop. This will likely need to be detected before continuing.
The topological sort will then insure that all the nodes sub-dependencies occur before it in the list. Thus creating the node would require creating all the sub-dependencies in topological order. See links for reference: https://en.wikipedia.org/wiki/Topological_sorting https://github.com/brianstorti/ruby-graph-algorithms/tree/master/topological_sort https://github.com/monora/rgl
This issue is an enhancement #238 and is not required until nodes start to become dependant on each other. It is not required if nodes are dependent on the
Domain
alone. However onceNode
s start referencing each other, it opens the possibility for cyclic paths creating an infinite dependency loop.Suppose we have the situation:
Firstly, all the dependent nodes (and doman) need to be identified without getting stuck in a loop. This can be done by reducing the nodes down to a hash: