A method of segmenting an image includes representing an image by a grid
with a plurality of nodes, terminals, and edges, the terminals including
a source and a sink. The edges include n-links and t-links, where each
n-link connects a pair of nodes, and the t-links connect a node to a
terminal, and each t-link and n-link has an associated cost. The method
includes initializing a node height table, a flow excess table, a t-link
capacity table, and an n-link capacity table based on the t-link and
n-link costs, and updating the node height table, the flow excess table,
the t-link capacity table, the said n-link capacity table in parallel for
all nodes until the flow excess table is zero for all nodes. The method
steps are performed in parallel for all nodes on a graphics processing
unit.