What is the easiest way to find the number of techs in the longest route to the base of a complicated tech tree from any given tech?

Each tech has the following properties:

Pre – A set of numbers, (bits), that must be turned on to enable research of that tech. Each number is separated by a space.

Def - A set of numbers, (bits), that are turned on when the tech is enabled or researched.

Id – A single number that is used to reference objects. It is not the index of an array (There could be the possibility of an Id of 2 and a Id of 3 but no Ids of 3, 4, 5).


The base, (start), of the tech tree has the following properties:

Base_tech – A set of numbers, (bits), that start out being turned on (Basically the same as Def).

No_dev_tech – A set of numbers, (bits), that defines which numbers, (bits), which can’t be turned on. If a tech has a Pre number that matches a number in No_dev_tech, then that tech is disabled and not in the tree. (It’s what keeps one race from using another race’s tech)

Station – A number that refers to the Id of a tech that you start out with.