0

I have set of sequential questions to ask the user. They follow a tree structure similar to this:

enter image description here

I have Questions 1-7 that should be asked to the user in the order of the tree. I was able to implement this with If statements but the problem is as the decision tree grows it is becoming hard to track the if statements. I dont know if this is a task for skilearn as I dont have hundred of datasets to feed an algorithm I just have a well defined question tree and questions to the user will follow this pathway. Looking things up looks like binary search tree is the way to go but even though I understand the concept in theory I have not found how to implement this data type into practical code for this. If someone has suggestions or site that will explain this in practical terms it will be great.

user2067030
  • 754
  • 1
  • 10
  • 27

1 Answers1

0

It should be a comment but I can't yet comment.

Here an answer that show an implementation in python of a binary tree. SO questions binary tree

In python3 for Tree data_structure you have a nice library call ete3. http://etetoolkit.org/ (not specific to binary tree)

Community
  • 1
  • 1
RomainL.
  • 997
  • 1
  • 10
  • 24