A Graph Theoretic Approach to Switching Function Minimization