docstr: :type beginWord: str
  :type endWord: str
  :type wordList: List[str]
  :rtype: int
docstr_tok: [":","type","beginWord",":","str",":","type","endWord",":","str",":","type","wordList",":","List","[","str","]",":","rtype",":","int"]
code: def ladderLength(self, beginWord, endWord, wordList):
      """
      :type beginWord: str
      :type endWord: str
      :type wordList: List[str]
      :rtype: int
      """
      if (
          endWord not in wordList
          or not endWord
          or not beginWord
          or not wordList
      ):
          return 0
  
      # Since all words are of same length.
      self.length = len(beginWord)
  
      for word in wordList:
          for i in range(self.length):
              # Key is the generic word
              # Value is a list of words which have the same intermediate generic word.
              self.all_combo_dict[
                  word[:i] + "*" + word[i + 1 :]
              ].append(word)
  
      # Queues for birdirectional BFS
      queue_begin = collections.deque(
          [beginWord]
      )  # BFS starting from beginWord
      queue_end = collections.deque(
          [endWord]
      )  # BFS starting from endWord
  
      # Visited to make sure we don't repeat processing same word
      visited_begin = {beginWord: 1}
      visited_end = {endWord: 1}
      ans = None
  
      # We do a birdirectional search starting one pointer from begin
      # word and one pointer from end word. Hopping one by one.
      while queue_begin and queue_end:
          # Progress forward one step from the shorter queue
          if len(queue_begin) <= len(queue_end):
              ans = self.visitWordNode(
                  queue_begin, visited_begin, visited_end
              )
          else:
              ans = self.visitWordNode(
                  queue_end, visited_end, visited_begin
              )
          if ans:
              return ans
  
      return 0
  
imports: from collections import defaultdict
label_desc: Use image node_id 3 for calling the Solution obj's underlying member method code with example usage: obj.ladderLength(beginWord, endWord, wordList) and returns: int, int, ans