Updated graph methods and implemented stochastic matrix check function