bark icon indicating copy to clipboard operation
bark copied to clipboard

Helper functions

Open adamjkb opened this issue 1 year ago • 5 comments

A collection of syntactic sugar functions to help make repetitive task easier. A couple of examples of what these might be called:

  • isDescendantOf
  • isChildOf
  • isSiblingOf
  • isRoot
  • isLeaf

The collection could also expose internal utility functions we are already using inside of the extension:

  • path_from_depth
  • increment_path

adamjkb avatar Jul 02 '23 17:07 adamjkb

I would also add a findLowestCommonAncestor method. LCA is a very common operation on graphs and the whole tree spanning from the LCA to the leaves (returned by findAncestors) might not be needed or might be so large it has a noticeable impact in performance.

kran6a avatar Feb 26 '24 16:02 kran6a

I would like to add a findLeafs helper

Nedi11 avatar May 29 '24 15:05 Nedi11

I would like to add a findLeafs helper

Could you expand on that? Would that be different to what findDescendants is doing?

adamjkb avatar May 29 '24 18:05 adamjkb

I would like to add a findLeafs helper

Could you expand on that? Would that be different to what findDescendants is doing?

e.x: lvl1->lvl2.1->lvl3.1 |->lvl2.2->lvl3.2 findDescendants gets all descendants. findDescendants on lvl1 would return lvl2.1 and lvl2.2 also if I am not mistaken (as well as lvl3). findLeafs would only return lvl3.1 and lvl3.2

**leaves is the correct plural of leaf so findLeaves I guess🙂

Nedi11 avatar May 29 '24 18:05 Nedi11

I would like to add a findLeafs helper

Could you expand on that? Would that be different to what findDescendants is doing?

e.x: lvl1->lvl2.1->lvl3.1 |->lvl2.2->lvl3.2 findDescendants gets all descendants. findDescendants on lvl1 would return lvl2.1 and lvl2.2 also if I am not mistaken (as well as lvl3). findLeafs would only return lvl3.1 and lvl3.2

**leaves is the correct plural of leaf so findLeaves I guess🙂

Ah yes, thank you! I get it now. I'll add it to the list, although ideally it should be possible to do if the results can filtered. (Currently not the case but it would be nicer if you could just filter leaves while querying the database)

adamjkb avatar May 30 '24 14:05 adamjkb