Method: BiDimensionalTree#get_depth_vert
- Defined in:
- lib/bi-dimensional-access.rb
#get_depth_vert(node = @root, depth = 1, maxdepth = 0) ⇒ Object
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/bi-dimensional-access.rb', line 244 def get_depth_vert(node = @root, depth = 1, maxdepth = 0) unless node.south.nil? maxdepth = get_depth_vert(node.south, depth + 1, maxdepth) end unless node.north.nil? maxdepth = get_depth_vert(node.north, depth + 1, maxdepth) end if node.south.nil? and node.north.nil? and depth > maxdepth maxdepth = depth end maxdepth end |