Boris,
as for the common nodes in between, you could take a look at the graph
algos in http://components.neo4j.org/neo4j/1.4.M03/apidocs/ . In
short, i think a AllPaths would be good for finding this out.

Alternatively, you could use Cypher to do this, see
http://docs.neo4j.org/chunked/snapshot/query-match.html, something
like

start me=(3)
match (me)-[:LIKES]->()<--(the_other), (me) -[:FRIEND]-> (the_other)
return the_other

Marko can pitch in the Gremlin version!

Cheers,

/peter neubauer

GTalk:      neubauer.peter
Skype       peter.neubauer
Phone       +46 704 106975
LinkedIn   http://www.linkedin.com/in/neubauer
Twitter      http://twitter.com/peterneubauer

http://www.neo4j.org               - Your high performance graph database.
http://startupbootcamp.org/    - Öresund - Innovation happens HERE.
http://www.thoughtmade.com - Scandinavia's coolest Bring-a-Thing party.



On Fri, Jun 10, 2011 at 2:19 AM, Boris Kizelshteyn <[email protected]> wrote:
> Hi All,
>
> Noob question here:
>
> Say that I am a node on the graph as are 3 of my other friends. No let's say
> that ice cream is a node and pizza is a node. Two of us like pizza, where
> like is the relationship (edge), and 3 of us like ice cream. I would like to
> know who likes ice cream and who likes pizza given just the people nodes.
> The ultimate goal is to determine who like the same things I do. What is the
> best way to do this?
>
> Currently I can accomplish what I'm looking for by getting all the
> relationships from each of the nodes and seeing where they lead and then
> seeing if these nodes are the same as mine. But it would seem that there may
> be a better way, like something that takes two (n) nodes and shows all the
> common relationship endpoints. Seems like this should be possible with
> paths, but I can't seem to figure it out.
>
> Bonus if you can give me an example in REST.
>
> Thanks so much!
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user
>
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to