try basic graph algorithms