Added graph algorithm