Skip to content

How to implement a graph of nodes without duplicate descendants? #237

Answered by staudenmeir
bluesheep100 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @bluesheep100,

However, I instead get a much larger number, where the counted set contains 36 copies of the grandchild Node.

The descendants query traverses the graph to discover all possible paths and return the nodes it finds on the way. The grandchild node is returned 36 times because 36 different paths lead to it. Each query result is a "combination" of a node and a path leading to it (represented by the depth and path attributes).

From the other issue:

If you have additional columns in the category_company pivot table, they can also be different for "duplicate" companies.

If your pivot table contains additional columns, the different grandchild query results have different piv…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
3 replies
@bluesheep100
Comment options

@staudenmeir
Comment options

@bluesheep100
Comment options

Answer selected by bluesheep100
Comment options

You must be logged in to vote
1 reply
@bluesheep100
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants