Sunday, July 3, 2016

Data Flow Graphs

In data flow graphs, computation is programmed as a directed graph. This graph enables the data flow across operations, where each node in the graph represents an operation or a computation. A node may send, receive or can send a response to a message that they received.



In the above data flow graph, the left most node generates the integer values from 1 to 10 and passes them to two successor nodes. One of the successors squares each value it receives and passes the result downstream. The second successor cubes each value it received and passed the result downstream. The right most node received values from both of the middle nodes. As it receives each value, it adds it to a running sum of values. When the application is run to completion, the value of sum will be equal to the sum of the sequence of squares and cubes from 1 to 10.

Given below is a pseudocode that represents above computations. Each function in the pseudocode is equivalent to a node in the graph.

No comments:

Post a Comment