code: def add_word_to_graph(graph, word, sent_idx, word_idx):
      """
      Add a node and possibly an edge for a word in a basic dependency graph.
      """
      node = graph.node.add()
      node.sentenceIndex = sent_idx + 1
      node.index = word_idx + 1
  
      if word.head != 0:
          edge = graph.edge.add()
          edge.source = word.head
          edge.target = word_idx + 1
          edge.dep = word.deprel
  
imports: from collections import deque
  import subprocess
  from stanza.models.common.utils import misc_to_space_after
  from stanza.models.constituency.parse_tree import Tree
  from stanza.protobuf import DependencyGraph, FlattenedParseTree
  from stanza.server.client import resolve_classpath
label_desc: Use image node_id 7 for calling a global function with example usage: add_word_to_graph(graph, word, sent_idx, word_idx) without return types