Topology of any one-dimensional complex can be represented by zero and one-dimensional homology groups which are isomorphic to the direct sum of additive groups. In this paper, a method of constraint on the topology of a frame treated as a one-dimensional complex is proposed using homology groups. As a numerical example, the total strain energy of the frame is minimized under the constraint of topology and constant weight. Useless members are eliminated from a ground structure by use of genetic algorithm. Any number of additive groups can be freely set up as a topological constraint because of the generalized inverse matrices, and a rule of code in the genetic algorithm is designed so that all strings generated in the process of optimization could satisfy the topological constraint. As a result, it is found that loops in the topology of the optimum structure adjoin each other. The proposed method is also applied to the topological optimization of a square board fixed on a rigid wall and loaded vertically on points distant from the wall.