Since there is more than tree, the right way to do this is using an enum.

@dhruv13J already solved this in #2089, you may take a look how it is done there. In fact, it would be good if you two guys synchronise somehow since you are both working on KNN. The ideal case would be if we can merge @dhruv13J's work soon.