As shown in [Rudd and Schroeder, 1982], the problem of margining option portfolios where option spreads with two legs are used for offsetting can be solved in polynomial time by network flow algorithms. However, spreads with only two legs do not provide sufficient accuracy in measuring risk. Therefore, margining practice also employs spreads with three and four legs. A polynomial time solution to the extension of the problem where option spreads with three and four legs are also used for offsetting is not known. In this paper we propose a heuristic network flow algorithm for this extension and present a computational study that proves high efficiency of this algorithm in margining practice.