Here's a sample flow graph:

* generate lookup tables for each chess piece for how many moves it takes to move to every square from every other square. From a single piece on an empty board on any square, you could then see how many moves it would take to reach any other square.
* for each piece in the chess position, start by making a weighted graph from the lookup table. Each vertex on the graph would represent a single square on the chess board that the piece could reach
* on each pieces' graph, calculate, from the other pieces' graphs, the resistance at each step in getting close to where the opponent king can get to (weighted by the cost of that king getting to each square on the board)
* opponents pieces' graphs would create resistance to your own pieces graphs (as would, to a lesser extent, your own pieces)
There would be a lot of circular expressions in this set of expressions (X depends on Y, Y depends on Z, Z depends on X), but getting to balance in circular expressions can be done quickly using various methods.
The move to choose would be the one that gives maximum flow to squares close to the opponents king and minimum flow for opponents pieces to get to your king.