Open
Description
I coded up a brief implementation of the AbstractTrees.jl interface here:
using AbstractTrees
import SpatialIndexing as SI
AbstractTrees.children(node::SI.Branch) = SI.children(node)
AbstractTrees.nodevalue(node::SI.Branch) = SI.mbr(node)
AbstractTrees.children(node::T) where {T <: SI.Leaf} = T[]
AbstractTrees.nodevalue(node::SI.Leaf) = leaf.children
AbstractTrees.ParentLinks(::Type{<: SI.Node}) = AbstractTrees.ImplicitParents()
AbstractTrees.SiblingLinks(::Type{<: SI.Node}) = AbstractTrees.ImplicitSiblings()
AbstractTrees.ChildIndexing(::Type{<: SI.Node}) = AbstractTrees.IndexedChildren()
AbstractTrees.NodeType(::Type{<:SI.Node{T,N,V}}) where {T,N,V} = SI.Node{T, N, V}
This provides iterators like DFS (post and pre ordered), BFS, and leaf iterators.
Would there be interest in a PR adding this + tests to the package? I am currently working on a problem that requires me to depth-first search down R-trees that partition geometries.
Let me know what you think @alyst!
Metadata
Metadata
Assignees
Labels
No labels