MATCH (n) return size((n)-[:FOO]->()) or
MATCH (n)-->() return n, count(*) should both work and in 2.2 at least use the fast node.getDegree() internally > Am 27.02.2015 um 09:31 schrieb NILESH KUMAR <[email protected]>: > > Hi Guys, > how can i filter my nodes based on the count of relationship. > for example let in my database i want to filter node having single relation > and keep others. > > > > > > > > > On Tuesday, March 27, 2012 at 7:43:02 PM UTC+5:30, Andres Taylor wrote: > > > On Tue, Mar 27, 2012 at 3:50 PM, kiteflo <[email protected] <>> wrote: > Hi guys, > > is there a simple way (Java or Cypher based) of getting the total > number of nodes and relationships in a Neo graph? Iterating is not an > option, something lightweight would be great in terms of > "template.getTotalNodes()"... > > Well, you can do: > > START n=node(*) > RETURN count(n) > > and conversely > > START r=relationship(*) > RETURN count(r) > > But, internally, they both iterate over all nodes/relationships, which you > indicated you didn't want... > > Andrés > > -- > 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 [email protected] > <mailto:[email protected]>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
