This paper presents a new approach ,to the automatic contingency selection and ranking by the network flow programming (NFP). A complex cost optimisation model based on economy and security, and several simplified models are proposed in the paper. The performance index is the total load curtailment or its weighted value. All the solution algorithms are OKA. The model and its algorithm is tested on IEEE 30-Bus System and the encouraging results are obtained.