|In this work we provide a method for generating quantum circuits preparing maximally multipartite entangled states using genetic programming. The presented method is faster that known realisations thanks to the applied fitness function and several modifications to the genetic programming schema. Moreover, we enrich the described method by the unique possibility to define an arbitrary structure of a system. We use the developed method to find new quantum circuits, which are simpler from known results. We also analyse the efficiency of generating entanglement in the spin chain system and in the system of complete connections.