On 04/03/2012 10:33 PM, Nick Sabalausky wrote:
Suppose you have a directed graph, which may have cycles, and you want to compute something for each node. But the final result for each node is dependent on the final results for each of the nodes it points to. (It may sound like this would just cause an endless "feedback loop" ie infinite recursion whenever there's a cycle, but there are applications of this where that isn't a problem. Ie, in cases where the computation stops recursing when it gets back to itself.)
Had to find my R. Sedgewick and N. Wirth Algorithm books.. But: these books do not even give a hint. Nada.
However the problem you describe smells like something for which the the "Chain of Responsibility Pattern" is made for.
Though this pattern requires a break condition 'cause you wont an endless search of an responsible
( Finally We are programmers, not politicians ) I have a hard time to image how your Graph Node might look. SOOOooooo... Here you go