Comparing two data sets and dividing based on their common items

Hi guys,

I need the wisdom and experience of this community to solve this problem. I am using two data sets which are starting locations and the count for them and ending location and count for them.
I am trying to make 4 different data sets as shown in the sketch.

  1. locations only in ‘Starting’ data with their numbers
  2. locations in ‘Starting’ data overlapping with ‘Ending’ data with their numbers
  3. locations only in ‘Ending’ data with their numbers
  4. locations in ‘Ending’ data overlapping with ‘Starting’ data with their numbers

And then I want to modify 2) and 4) to compare the counts and add up.

But there are problems holding me back at the moment. It is hard to use ‘set’ component to organize the data in the way I think I need because of the order of ‘places’ in one data is different from the other. Also, there are numeric data in each list together with the place I think affects ‘set’ components I am trying to use. Is there an alternative way to deal with this problem?

I am attaching a GH file with internalized data and a sketch of what I want to achieve with this. Thanks!
210921 ORGANIZING DATA TREE.gh (18.3 KB)


Moved to Grasshopper category.

1 Like

If I understand you right, this is something that you are after.


210921 ORGANIZING DATA TREE_re.gh (19.2 KB)

1 Like

Hi @HS_Kim,

Thank you for your help. What you have provided was what I was looking for.
Also, I added another step adding up ‘End’ data location counts to relevant branches of ‘Start’ data.
The definition you have provided was very helpful in solving this.
Thank you!


210922 ORGANIZING DATA TREE_re.gh (21.6 KB)