def DFS(self, temp, templen, v, visited):
        # Mark the current vertex as visited
        visited[v] = True

        # Add this vertex and its shift to the current component
        if len(temp)>0:
            prevv = temp[templen-1][0]
            shift = temp[templen-1][1] + self.pairwiseShifts[v, prevv]
            print("total shift %.2f at %d / %s" %(shift, v, self.allrecs[v]))
        else:
            shift = 0
        temp.append((v, shift))
        templen = len(temp)

        # Run DFS for all vertices adjacent to this
        listOfNeighbours = np.nonzero(self.recConnections[v,])[0]
        print("Neighbours are", [self.allrecs[nb] for nb in listOfNeighbours])
        for i in listOfNeighbours:
            if not visited[i]:
                temp = self.DFS(temp, templen, i, visited)
        return temp