Hi Fajar, You can do that by writing either server plugins, or unmanaged extensions.
Here is how: http://docs.neo4j.org/chunked/milestone/server-plugins.html http://docs.neo4j.org/chunked/milestone/server-unmanaged-extensions.html Cheers, Dario Am 22.06.11 15:22 schrieb "Fajar Maulana Firdaus" unter <[email protected]>: > I have been reading a little bit about gremlin, I think it is really great. > > However is it possible to get similar result using REST API? > > regards, > > > On Fri, Jun 17, 2011 at 8:31 PM, Marko Rodriguez <[email protected]>wrote: > >> Hi, >> >> In Gremlin (http://gremlin.tinkerpop.com), friends of a friend (FOAF) who >> are not my friends: >> >> x = [] as Set >> g.v(1).out('friend').aggregate(x).out('friend').except(x) >> >> - x is a Set to save intermediate friend vertices to to exclude (except) >> from the final step. >> - g is your graph (e.g. g = new Neo4jGraph('/tmp/graph')) >> - g.v(1) will grab vertex 1 by its id >> >> If you give me some particular things you want to say, I can provide you >> the Gremlin code to do it. >> >> Thanks, >> Marko. >> >> http://markorodriguez.com >> >> On Jun 17, 2011, at 7:08 AM, [email protected] wrote: >> >>> Oh thank you, >>> >>> As I mentioned, I am new to neo4j. So a little sample code would be very >> useful in my learning process. :) >>> >>> My current state is that I managed to add few nodes, and add friend >> relationship between several nodes. >>> >>> User - friend - other node. >>> >>> Friend is relationship >>> >>> I don't have a very big node number so I think your suggested approach >> will work. >>> >>> Fajar >>> >>> Sent from my BlackBerry® smartphone from Sinyal Bagus XL, Nyambung >> Teruuusss...! >>> >>> -----Original Message----- >>> From: Peter Neubauer <[email protected]> >>> Sender: [email protected] >>> Date: Fri, 17 Jun 2011 14:12:48 >>> To: Neo4j user discussions<[email protected]> >>> Reply-To: Neo4j user discussions <[email protected]> >>> Subject: Re: [Neo4j] Find 2nd degree friends in order of mutual friend >>> >>> Hi Fajar, >>> this is a depth 2 traversal from the person in question. While >>> exhaustively traversing his friends, you increase the group count as >>> for each FOAF you get on the second step. >>> >>> However, we have seen edge cases with supernodes where in a social >>> network, persons can have 50K friends. There, you might use heuristics >>> or indexing approaches to make this very fast. >>> >>> If you have some more details, I could write down the query in Gremlin >>> or Cypher (http://docs.neo4j.org/chunked/snapshot/cypher-query-lang.html >> ), >>> but in principle, it would be like >>> https://github.com/tinkerpop/gremlin/wiki (actually using 3 steps, I >>> think we could get it down to 2) for Gremlin. >>> >>> In neo4j, if things are not cached, only the parts the data that are >>> needed for this traversal wil be loaded from disk, so you don't need >>> to hold all the graph in cache for this, since it is a data-local >>> operation. >>> >>> HTH >>> >>> 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 17, 2011 at 1:33 PM, Fajar Maulana Firdaus >>> <[email protected]> wrote: >>>> Hi all, >>>> >>>> I am new to neo4j and excited to know more about graph database. >>>> >>>> First of all, could anyone please help me to figure out the >> documentation >>>> about the query or rest client? >>>> >>>> Then, back to my question, I want to find 2nd degree friends but ordered >> by >>>> number of mutual friend. I understand that if I have all data in memory, >> I >>>> could've traverse the graph to 2nd level, and keep counter for each >> nodes in >>>> 2nd level. So in away its like finding all paths from start node to all >>>> second degree friend, but if we do that, it would be inefficient. >>>> >>>> Does anyone have any idea how to do this with neo4j? >>>> >>>> Thank you, >>>> Fajarmf >>>> _______________________________________________ >>>> Neo4j mailing list >>>> [email protected] >>>> https://lists.neo4j.org/mailman/listinfo/user >>>> >>> _______________________________________________ >>> Neo4j mailing list >>> [email protected] >>> https://lists.neo4j.org/mailman/listinfo/user >>> _______________________________________________ >>> Neo4j mailing list >>> [email protected] >>> https://lists.neo4j.org/mailman/listinfo/user >> >> _______________________________________________ >> Neo4j mailing list >> [email protected] >> https://lists.neo4j.org/mailman/listinfo/user >> > _______________________________________________ > Neo4j mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

