Changed partial graph generation method to more efficent one.