Over the years, graph theory has proven to be a key tool in power systems modeling and analysis. In this paper, the authors propose a systematic method for railway power supply systems (RPSS) description that can be applied to any AC/DC system. This method represents the different elements of the RPSS with a set of subgraphs. Merging these subgraphs, the representative graph of the whole RPSS and its associated adjacency and incidence matrices will be obtained. Once these matrices are obtained, Kirchhoff's laws can be easily implemented. In this work, the method is applied to a DC light traction system. The AC system that feeds the traction network through power transformers combined with rectifiers is also included. With the proposed approach, the variability problems in the system topology and dimensions are overcome, obtaining an invariant system, even when the trains change their relative position, or when a new train enters into or exits the system.