The κ-mutual exclusion is the problem of guaranteeing that no more than κ computing nodes enter a critical section simultaneously in a distributed system. The use of a κ-coterie, which is a special set of node groups, is known as a robust approach to solve this problem. So far, several methods have been proposed for constructing κ-coteries that provide high availability. Although, among them, κ-majority coteries have been shown to be optimal in terms of availability for fully connected networks with completely reliable links, no construction of optimal κ-coteries has been suggested for general networks. In this paper, we propose a method for constructing optimal κ-coteries in general topology networks with unreliable nodes and links. In the proposed method, the problem of finding an optimal κ-coterie in a general network is formulated as a 0-1 integer nonlinear programming problem. To solve the formulated problem, we also propose a branch-and-bound method based on a linear programming relaxation. The feasibility of the proposed method is shown through an experiment conducted for several networks.