code: def shortest_path_length(graph_data, source, cutoff=None):
      """Compute the shortest path lengths from source to all reachable nodes in a GraphData object.
  
      This function only works with undirected graphs.
  
      Parameters
      ----------
      graph_data : GraphData
          GraphData object containing the graph information
  
      source : int
         Starting node index for path
  
      cutoff : int, optional
          Depth to stop the search. Only paths of length <= cutoff are returned.
  
      Returns
      -------
      lengths : dict
          Dict of node index and shortest path length from source to that node.
  
      Examples
      --------
      >>> import numpy as np
      >>> node_features = np.random.rand(5, 10)
      >>> edge_index = np.array([[0, 1, 2, 3, 4], [1, 2, 3, 4, 0]], dtype=np.int64)
      >>> graph_data = GraphData(node_features, edge_index)
      >>> shortest_path_length(graph_data, 0)
      {0: 0, 1: 1, 2: 2, 3: 2, 4: 1}
      >>> shortest_path_length(graph_data, 0, cutoff=1)
      {0: 0, 1: 1, 4: 1}
  
      """
      if source >= graph_data.num_nodes:
          raise ValueError(f"Source {source} is not in graph_data")
      if cutoff is None:
          cutoff = float("inf")
  
      # Convert edge_index to adjacency list
      adj_list = [[] for _ in range(graph_data.num_nodes)]
      for i in range(graph_data.num_edges):
          src, dest = graph_data.edge_index[:, i]
          adj_list[src].append(dest)
          adj_list[dest].append(src)  # Assuming undirected graph
  
      # Breadth-first search
      visited = np.full(graph_data.num_nodes, False)
      distances = np.full(graph_data.num_nodes, np.inf)
      queue = [source]
      visited[source] = True
      distances[source] = 0
  
      while queue:
          node = queue.pop(0)
          for neighbor in adj_list[node]:
              if not visited[neighbor]:
                  visited[neighbor] = True
                  distances[neighbor] = distances[node] + 1
                  if distances[neighbor] < cutoff:
                      queue.append(neighbor)
  
      return {i: int(d) for i, d in enumerate(distances) if d <= cutoff}
  
file_path: deepchem/deepchem/feat/graph_data.py
imports: from typing import Optional, Sequence
  import numpy
label_desc: Use image node_id 1 for calling a global function with example usage: shortest_path_length(graph_data, source, cutoff) and returns: unknown