The authors have approached in the past different railway engineering problems (e.g. [1,2]) and have developed software for the Spanish Railway Foundation [3], mainly using computer algebra systems (CAS). Now a CAS is used for designing and implementing a software package that allows to compare different layout diagrams for overtaking stations [4], from the point of view of its flexibility (for instance in degraded working conditions). The most common cases of overtaking stations (stations on double track lines with one or two sidings each side of the main line and one or two crossovers at the two throats of the overtaking station) are considered as illustration. It will be shown how, surprisingly, the usual position of the
crossovers is not optimum from this point of view. The key idea is to use graph theory to determine the number of pairs of non conflicting itineraries (one in each direction) that can be simultaneously authorized by the railway interlocking system. The package can be applied to an overtaking station with any layout diagram. This is an important issue: for instance, the Spanish infrastructure administrator (Adif) is now planning a new track layout for Madrid Chamartín station [5] and the Iberian gauge part of Madrid Atocha station.Universidad de Málaga. Campus de Excelencia Internacional Andalucía Tech