Inferring social structure from temporal data