Marko Rodriguez-2 wrote:
>
>>
>>> "For all nodes in a particular index, how many other nodes are they
>>> connected to at depth X?"
>
> Here is how I would do it -- groupCount is not needed.
>
> g.idx(index_name)[[key:value]].both.loop(1){it.loops < depth}.count()
>
>
Thanks Marko. A couple questions...
Won't this count dupes more than once?
Xavier's requirements of "how many other nodes are they connected" sounds
like you should only count uniques, and that's why I am checking the size of
groupCount map instead of using count(). Instead of a map you could use a
Set with aggregate(), but I wasn't sure if they'd have the aggregate-loop
fix yet.
Also Xavier said, "For all nodes in a particular index". I took that to mean
all nodes in an index, not all nodes for a particular value in an index,
hence the wildcard query:
index_nodes = g.idx(index_name).get(index_key,Neo4jTokens.QUERY_HEADER +
"*")
However, I am not sure/can't remember if you can do a wildcard query without
at least one leading character.
- James
--
View this message in context:
http://neo4j-community-discussions.438527.n3.nabble.com/Neo4j-Aggregate-queries-tp3317720p3319768.html
Sent from the Neo4j Community Discussions mailing list archive at Nabble.com.
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user