Implentation of some graph algoritms