filter

5 views
Skip to first unread message

Manolo Velduque

unread,
Nov 11, 2012, 5:43:05 PM11/11/12
to neo...@googlegroups.com
Hi !

Is it possible to filter nodes in the graph algorithms?

e.g.

algs = Neo4j::Algo.all_simple_paths(my,obj).outgoing(:have).incoming(:likes)

I tried everything and it does not seem possible .....

It seems too get all the routes first and then have to cross it to filter


Thanks !!

Andreas Ronge

unread,
Nov 12, 2012, 3:36:16 AM11/12/12
to neo...@googlegroups.com

Hi

Well, you could do it in ruby with normal find_all method. If that is too slow, then have a look at Cypher.

I guess it will be something like this

   Neo4j.query(my,obj) do
      my - "r:have|likes*" - obj
      // add condition on relationships r here, or condition on the whole path.
   end 

Maybe you can also use the Neo4j::Algo expand method, e.g.:
Neo4j::Algo.shortest_path(@x,@y).expand{|node| node._rels(:outgoing, :friends)}
to tell which paths to use.

Cheers
Andreas

--
You received this message because you are subscribed to the Google Groups "neo4jrb" group.
To post to this group, send email to neo...@googlegroups.com.
To unsubscribe from this group, send email to neo4jrb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/neo4jrb?hl=en.

Reply all
Reply to author
Forward
0 new messages