Added business logic for Graph Algorithm