Create topologies.c

Old version of the code.