As to how the pattern matching works (I believe): Worst case scenario is a
linear scan (from the starting points given), but it tries to prune
branches/paths as quickly it finds out that there's no longer any need to go
further (as soon as there are pattern mismatches) and instead continues down
other branches.

2011/6/18 Andres Taylor <andres.tay...@neotechnology.com>

> Are you referring to what the implementation looks like? This is the
> source.
> I haven't grokked it yet, so I can't give you a TL;DR;, sorry.
>
> https://github.com/neo4j/community/tree/master/graph-matching
>
> Cypher allows you to do graph-matching (internally, it uses the above
> module), but adds a few more bells and whistles to it.
>
> If you have any Cypher questions, ask away.
>
> Andrés
>
> On Sat, Jun 18, 2011 at 8:13 PM, Aman <aman.6...@gmail.com> wrote:
>
> > Jim,
> > I was going through Cypher and a question came into my mind regarding
> > pattern matching... How is pattern matching done in neo4j? I mean, how
> > are nodes and relationships matched in case of large data-sets?
> >
> > On 6/18/11, Aman <aman.6...@gmail.com> wrote:
> > > Jim,
> > > Thanks for the valuable input... The use case I mentioned here (using
> > > only visited places) was a simplistic version of the real one,
> > > because, just as you said, I'd be getting large number of results in
> > > that case... I'd check out pattern matching and Cypher to ease me in
> > > my project... Neo4j team is truly awesome! You guys are always there
> > > to help...
> > >
> > > On 6/18/11, Jim Webber <j...@neotechnology.com> wrote:
> > >> That's a great point.
> > >>
> > >> In Neo4j you can add properties to your relationships so that:
> > >>
> > >> Jim --VISITED (numberOfTimes: 20) --> Melbourne
> > >>
> > >> Then you can use the "numberOfTimes" property to determine whether or
> > not
> > >> you'd like to include the person/city in the recommendations you're
> > >> making.
> > >> In this case it seems I'm rather keen on Melbourne, so you might want
> to
> > >> recommend me to other folks who visit Melbourne a lot.
> > >>
> > >> As for whether it's more efficient than other databases, I suspect it
> is
> > >> in
> > >> the general case since this is a graph operation which other kinds of
> > >> stores
> > >> will have to reify for themselves (e.g recursive joins, big map/reduce
> > >> job,
> > >> etc). The cost of these kind of operations in Neo4j tends to be very
> > low.
> > >>
> > >> Jim
> > >>
> > >>
> > >> On 18 Jun 2011, at 07:56, faja...@gmail.com wrote:
> > >>
> > >>> Ah this discussion is interesting, I want to join and throw in sonme
> > >>> idea
> > >>> too.
> > >>>
> > >>> If a user can visit a place for multiple times. And if there are 100
> > >>> user
> > >>> visit USA. So we should suggest top 10 only.
> > >>>
> > >>> Would traversing the graph be more efficient than normal database
> > query?
> > >>>
> > >>>
> > >>> Sent from my BlackBerry® smartphone from Sinyal Bagus XL, Nyambung
> > >>> Teruuusss...!
> > >>>
> > >>> -----Original Message-----
> > >>> From: Aman <aman.6...@gmail.com>
> > >>> Sender: user-boun...@lists.neo4j.org
> > >>> Date: Sat, 18 Jun 2011 10:50:34
> > >>> To: Neo4j user discussions<user@lists.neo4j.org>
> > >>> Reply-To: Neo4j user discussions <user@lists.neo4j.org>
> > >>> Subject: Re: [Neo4j] Generating suggestions in a Neo4j db
> > >>>
> > >>> Hi Jim,
> > >>> The way you mentioned, that will take care of these suggestions,
> > >>> thanks for the same. But here's a tougher problem....
> > >>> If I have a database of 50k people, and I want to find friends based
> > >>> upon the places that those 50k people have visited (i.e. People who
> > >>> have visited same places as me should be suggested as friends to me),
> > >>> then how to to that... I've thought all that I could, but I always
> > >>> come up with something stupid... Any suggestions about this?
> > >>>
> > >>> On 6/18/11, Aman <aman.6...@gmail.com> wrote:
> > >>>> Hi Jim,
> > >>>> The way you mentioned, that will take care of these suggestions,
> > >>>> thanks for the same. But here's a tougher problem....
> > >>>> If I have a database of 50k people, and I want to find friends based
> > >>>> upon the places that those 50k people have visited (i.e. People who
> > >>>> have visited same places as me should be suggested as friends to
> me),
> > >>>> then how to to that... I've thought all that I could, but I always
> > >>>> come up with something stupid... Any suggestions about this?
> > >>>>
> > >>>> On 6/18/11, Jim Webber <j...@neotechnology.com> wrote:
> > >>>>> Hi Aman,
> > >>>>>
> > >>>>> I'm puzzled.
> > >>>>>
> > >>>>> Why not
> > >>>>>
> > >>>>> Aman--HAS_VISITED-->USA
> > >>>>> Jim--HAS_VISITED-->India
> > >>>>>
> > >>>>> And if:
> > >>>>>
> > >>>>> Aman--FRIEND-OF-->Jim
> > >>>>>
> > >>>>> Then you just need to traverse from Aman following outgoing
> FRIEND_OF
> > >>>>> relationships to all your friends, and then traverse out their
> > >>>>> outgoing
> > >>>>> HAS_VISITED relationships to find places your friends have been.
> > >>>>>
> > >>>>> The general idiom with Neo4j is use indexes the find your start
> node
> > >>>>> (e.g.
> > >>>>> the Aman node in the above) then traverse from there.
> > >>>>>
> > >>>>> Jim
> > >>>>>
> > >>>>> _______________________________________________
> > >>>>> Neo4j mailing list
> > >>>>> User@lists.neo4j.org
> > >>>>> https://lists.neo4j.org/mailman/listinfo/user
> > >>>>>
> > >>>>
> > >>>>
> > >>>> --
> > >>>> Amandeep
> > >>>> +91-9878483857
> > >>>>
> > >>>
> > >>>
> > >>> --
> > >>> Amandeep
> > >>> +91-9878483857
> > >>> _______________________________________________
> > >>> Neo4j mailing list
> > >>> User@lists.neo4j.org
> > >>> https://lists.neo4j.org/mailman/listinfo/user
> > >>> _______________________________________________
> > >>> Neo4j mailing list
> > >>> User@lists.neo4j.org
> > >>> https://lists.neo4j.org/mailman/listinfo/user
> > >>
> > >> _______________________________________________
> > >> Neo4j mailing list
> > >> User@lists.neo4j.org
> > >> https://lists.neo4j.org/mailman/listinfo/user
> > >>
> > >
> > >
> > > --
> > > Amandeep
> > > +91-9878483857
> > >
> >
> >
> > --
> > Amandeep
> > +91-9878483857
> > _______________________________________________
> > Neo4j mailing list
> > User@lists.neo4j.org
> > https://lists.neo4j.org/mailman/listinfo/user
> >
> _______________________________________________
> Neo4j mailing list
> User@lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user
>



-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to