Updated graph analysis code