Hi Michael,
The data is from one website. The user_id is the ID of each registered user. And every user_id is linked to one or more cookie_ids (the value of one cookie).
Also one cookie_id is linked to one or more user_ids. So user_id and cookie_id are many to many mapping. My case is to find all user_ids linked with each other (via cookie_ids, and no limit on the path length) and assign them one unique ID (here i used then smallest user_id in the path).
for example:
All user_ids (user_id1, user_id2, user_id3) in the following path should be assigned one same ID (e.g. user_id1)
user_id1----cookie_id1----user_id2-----cookie-id2-----user_id3
I imported the data to neo4j and use different labels for user_id and cookie_id. There is only one type of relationship (cookie_id -- user_id) and the direction doesn't matter.