adding some graph algorithm