thomasxwright / Feather-Trace

1 stars 0 forks source link

Show more than one preview image for taxonomies with only one subgroup. #23

Closed thomasxwright closed 1 year ago

thomasxwright commented 1 year ago

Currently it only picks one example bird for each subgroup. Which means that a taxonomy with only one subgroup only gets one preview image, even if that subgroup has many birds under it.

Plan: grab up to a certain number of images (possibly different depending on screen size)

In this general pattern which will require a recursive tree traversal algorithm:

Push one sample image from each subtaxonomy until you reach the quota or have used all available images. Get the next image from a bird as distantly related as possible to the one you already grabbed.

thomasxwright commented 1 year ago

Algorithm ideas:

A depth-first search which steps out of each traversed path as if playing hot potato, bouncing off to the most distant and untouched path that's still available.

start at the root node. When looking at the current layer of the tree, are there any children we haven't traveled to yet? If so, travel that way.

thomasxwright commented 1 year ago

Created the algorithm by forming the taxonomic tree into a tree of queues. When a node is plucked from, it is moved to the back of the queue compared to its siblings. It works perfectly.