Get introduced (linkedin like)

Showing 1-4 of 4 messages
Get introduced (linkedin like) Amit Gupta 1/3/13 6:23 AM
I am using neo4j with people and companies as nodes and friend_of/works_at relationship between these.
I would like to know how to implement a get introduced to a second degree connection that linked in uses. The idea is to get your second degree connections at the company you wish to apply. If there are these second degree connections, then you would like to know who among your 1st deg connections can introduce y*ou to these 2nd deg connections.

For this I'm trying this query : 

    START from = node:Nodes(startNode), company = node:Nodes(endNode)
    MATCH from-[:FRIEND_OF]->f-[:FRIEND_OF]-fof-[:WORKS_AT]->company
    WHERE not(fof = from) and not (from-[:FRIEND_OF]->fof)
    RETURN distinct,,

But, this returns duplicate friend of friend names (, since the distinct is applied on all the parameters that are returned as a whole. It could be like I have friends X and Y who are both connected to Z who works at company C. This way, I get both X-Z-C and Y-Z-C. But, I want to apply distinct on Z, such that I get either X-Z-C or Y-Z-C or maybe a list/collection/aggregate of all friends that connect to Z. This could like ["X","Y"..]->Z How should I modify my query?

Amit Gupta

Re: [Neo4j] Get introduced (linkedin like) Wes Freeman 1/3/13 7:21 AM
Hey Amit,

I would do a collect, like:

RETURN, collect(distinct as friends_of_friends,



Re: [Neo4j] Get introduced (linkedin like) Amit Gupta 1/3/13 7:40 AM
Hi wes, but this doesn't solve the problem..
what I want to know is some of my friends who can connect me with a 2nd deg friend.
So, in the case my friends x and y can connect me to z, i should have ["x", "y"] -> z.

The query above gives me some 1st deg friends (duplicated) and a list of 2nd deg friends they can introduce. Also, as I stated this list is duplicated. I want the results the other way round..
Re: [Neo4j] Get introduced (linkedin like) Wes Freeman 1/3/13 7:56 AM
It would help if you built a sample graph in, so we can poke at it.

Maybe you want the collect on the instead of the