code: def combine_2_graphs(graph1, graph2):
      """
      Combine two graphs into one. Do this by recognising common nodes between the two.
      Args:
          graph1: Graph to compare
          graph2: Graph to compare
      Returns:
          Combined graph
      """
  
      for node, data in graph1.nodes(data=True):
          if graph2.has_node(node):
              data2 = graph2.nodes[node]
              if data2 != data:
                  raise ValueError(
                      (
                          f"Found non-matching node properties for node {node} "
                          f"between graphs {graph1} and {graph2}:\n"
                          f"In graph {graph1}: {data}\n"
                          f"In graph {graph2}: {data2}"
                      )
                  )
  
      for sender, receiver, keys, data in graph1.edges(
          data=True, keys=True
      ):
          if graph2.has_edge(sender, receiver, keys):
              data2 = graph2.edges[sender, receiver, keys]
              if data2 != data:
                  raise ValueError(
                      (
                          f"Found non-matching edge properties for edge {sender, receiver, keys} "
                          f"between graphs {graph1} and {graph2}:\n"
                          f"In graph {graph1}: {data}\n"
                          f"In graph {graph2}: {data2}"
                      )
                  )
  
      return nx.compose(graph1, graph2)
  
file_path: typedb-ml/typedb_ml/networkx/queries_to_networkx.py
imports: import warnings
  from functools import reduce
  import networkx
  from typedb_ml.typedb.thing import build_thing
  from typedb_ml.networkx.concept_dict_to_networkx import concept_dict_to_networkx
label_desc: Use image node_id 3 for calling a global function with example usage: combine_2_graphs(graph1, graph2) and returns: nx