Abstract:An approach called "From-To Calculation Algorithm Based on Flow Graph" is presented. It is used to calculate the "from-position" and "to-position" of flow in complex piping network. By representing the piping network with graph topology, using the principle of maze backtracking, the direction of all the aspects can be determined in the piping system. A general component of the algorithm is developed using C# computer language based on generic parameter, interface technology and delegated observer mode. The algorithm is then applied to a mine drainage system. By taking the water pumps & joints as nodes, and pipes as edges, all flow "From-To" can be automatically calculated with "flow graph algorithm". Application results show that it can be an effective solution to calculate where a flow is from and where it will go.