I have a partially or entirely cyclic graph for which I want to calculate the cost of each node based on the weighted sum of the costs of preceding nodes. Nodes without incoming edges have a fixed cost assigned to them.
For example, the following graph has each node labeled with its calculated cost (the cost of node 2 is fixed), and each edge is labeled with the weight of the preceding node. Thus, the node 1.33 cost is calculated from 1*0.33 + 0.5*2.
I currently use an iterative approach to calculate the cost of each node to within some epsilon, but am looking for an algorithm that can calculate the costs exactly. The example above is pretty simple, the actual problem deals with ~100 nodes per strongly connected component. Any suggestions for an algorithm that can solve this?