It returns the sum of the length of all compartments forming the given branch