1. A method for determining connectivity components defined by a set of relations over a set of data elements, wherein the relations and the data elements are stored in a database, the method comprising: selecting, for each first data element in the set of data elements, a respective second representative data element from among a group of data elements that includes the first data element and those data elements linked to the first data element by a path of relations, including assigning, to each of the data elements in the set of data elements, a random value and basing the selecting on the respective random values assigned to the data elements in the group; for each first data element, identifying a respective data element assigned to be a leader of each first element and replacing the assigned data element with the representative data element of the first element as the leader of the first element; iteratively creating a new set of relations by replacing each first data element of the set of data elements by its representative in the set of relations; and outputting the leader of each data element as an identifier of the connectivity component of which the data element is a member; wherein the selecting and creating are performed within the database.