> > match path = shortestPath( (n)-[*]->(m) ) > return collect(distinct unwind(nodes(path))), collect(distinct > unwind(rels(path))) > > What do you think? > Thanks for the info, Alan! I too am interested in extracting subgraphs from a large hierarchy of wiki pages. :-)
What I'm doing seems less complex b/c that data is in a single inheritance hierarchy, but I'm still figuring out the best way to extract related nodes. I want to find "active" sub-trees in a hierarchy of ~100,000 wiki pages. I'm looking for pages recently updated (i.e. connected to recent "Day" nodes), then I want to select the page, it's peers, children, and lineage of parent pages up the tree to nearly the top of the "wiki space". I imported a Confluence wiki space into Neo, along with a Year/Month/Day time tree ala Mark Needham <http://www.markhneedham.com/blog/2014/04/19/neo4j-cypher-creating-a-time-tree-down-to-the-day/>, and linked the Day nodes to the Page nodes based on modification Y/M/D. // Active match (but not complete) sub-tree MATCH (y:Year)-->(m:Month)-->(d:Day)<--(p:Page)<-[r:PARENT_OF*]-(parent:Page )<-[:CONTAINS]-(s:Space)<--(server:Server) where y.year=2015 // and m.month=1 // and s.key='DIRX' return p,r,parent,s,server,y,m,d That query yields all recently updated pages and parents, but not the peers, children, and related sub-trees (niece/nephews as it were). <https://lh3.googleusercontent.com/-kj69Q66ti70/VywX27lPuYI/AAAAAAAAAvQ/Z0BsGLgGEeoIYtgi-vpL0e54MukVI7bHACLcB/s1600/Neo4j.png> Anyway, I'm learning as I go and just wanted to share. :) -Tim -- You received this message because you are subscribed to the Google Groups "Neo4j" group. To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.