A topological approach to the analysis of switching circuits