Something like:
@neo.traverse(node1,"paths", {"order" => "breadth first",
"uniqueness" => "relationship path",
"relationships" => {"type"=>
"knows", "direction" => "out"},
"return filter" => {
"language" => "javascript",
"body" => "position.length() <= 3
&&
position.endNode().getId() == #{node2.id}
&&
position.lastRelationship().getProperty(\"rating\") > -1;"}
On Mon, Jun 27, 2011 at 7:18 AM, Rugal wrote:
> Hi, I'm starting to use Neo4j with the ruby neography library. Everything it's
> working, I'm correctly managing nodes, relations and indexes (it would be
> great something less manual, in order to have a faster boot/setup/learning
> curve). But now I'm having a little problem on doing one thing:
>
> I've nodes connected between them, and the relations can have a rating
> property, which is a numeric value (positive, negative or zero). I'd like to
> get all the simple paths up to the third level depth from a node to another,
> but considering also the rating property, in this way: a path is valid if the
> rating is greater than or equal to 0, but it should consider it if the
> property is set on the last relation, also if it's negative.
>
> Very simple example
>
> A -(-5)-> B
> B --> C
> A --> D
> D --> C
>
> Then from A to C the valid paths resulting would be only A --> D --> C
>
> A --> B
> B -(-5)-> C
> A --> D
> D --> C
>
> This one the result paths would be:
> A --> D --> C
> A --> B --> C
> Because the negative rating is on the last relationship, not in the middle, so
> the path should be present
>
>
> For now I get all the paths using
> get_paths(from_node, to_node, { "type"=> "knows", "direction" => "out" },
> depth=3, algorithm="allSimplePaths")
>
> How can I make it consider that conditions too? Should I use a traversal? Do
> you have hint on how write that conditions?
>
> Thank you
>
>
>
> --
> Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
> autenticato? GRATIS solo con Email.it http://www.email.it/f
>
> Sponsor:
> All'hotel Roland Riccione Euro 48 in pensione completa con bevande ai pasti
> e 2 biglietti per i parchi divertimento della zona
> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=11574&d=27-6
> ___
> 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