code: def load_network(input_data):
      # Create country_decade feature
      dt_collect = input_data[
          ["eventid", "country_txt", "iyear", "gname"]
      ]
      dt_collect["decade"] = (dt_collect["iyear"] // 10) * 10
      dt_collect["country_decade"] = (
          dt_collect["country_txt"]
          + "_"
          + dt_collect["decade"].map(str)
          + "s"
      )
      dt_collect = dt_collect[dt_collect.gname != "Unknown"]
  
      # Create a country_decade edgelist
      gnames_country_decade = (
          dt_collect.groupby(["gname", "country_decade"])
          .agg({"eventid": "count"})
          .reset_index()
      )
      gnames_country_decade_edgelist = pd.merge(
          gnames_country_decade,
          gnames_country_decade,
          on="country_decade",
          how="left",
      )
      gnames_country_decade_edgelist.drop(
          ["eventid_x", "eventid_y"], axis=1, inplace=True
      )
      gnames_country_decade_edgelist.columns = [
          "source",
          "country_decade",
          "target",
      ]
      gnames_country_decade_edgelist = gnames_country_decade_edgelist[
          gnames_country_decade_edgelist.source
          != gnames_country_decade_edgelist.target
      ]
  
      G_country_decade = nx.from_pandas_edgelist(
          gnames_country_decade_edgelist,
          source="source",
          target="target",
      )
  
      # Create edgelist from the related column
      dt_collect = input_data["related"]
      dt_collect.dropna(inplace=True)
      gname_event_mapping = input_data[
          ["eventid", "gname"]
      ].drop_duplicates()
      gname_event_mapping.eventid = gname_event_mapping.eventid.astype(
          str
      )
  
      G_related = nx.parse_adjlist(
          dt_collect.values, delimiter=", "
      )  # attacks that are related
      df_related = nx.to_pandas_edgelist(G_related)
      df_related.replace(" ", "", regex=True, inplace=True)
      df_source_gname = pd.merge(
          df_related,
          gname_event_mapping,
          how="left",
          left_on="source",
          right_on="eventid",
      )
      df_source_gname.rename(
          columns={"gname": "gname_source"}, inplace=True
      )
      df_target_gname = pd.merge(
          df_source_gname,
          gname_event_mapping,
          how="left",
          left_on="target",
          right_on="eventid",
      )
      df_target_gname.rename(
          columns={"gname": "gname_target"}, inplace=True
      )
  
      # Filtering and cleaning
      gnames_relations_edgelist = df_target_gname[
          df_target_gname.gname_source != df_target_gname.gname_target
      ]
      gnames_relations_edgelist = gnames_relations_edgelist[
          gnames_relations_edgelist.gname_source != "Unknown"
      ]
      gnames_relations_edgelist = gnames_relations_edgelist[
          gnames_relations_edgelist.gname_target != "Unknown"
      ]
      gnames_relations_edgelist = gnames_relations_edgelist[
          ["gname_source", "gname_target"]
      ]
      gnames_relations_edgelist.dropna(inplace=True)
  
      G_rel = nx.from_pandas_edgelist(
          gnames_relations_edgelist,
          source="gname_source",
          target="gname_target",
      )
  
      # Merging two graphs
      G = nx.compose(G_country_decade, G_rel)
  
      return G
  
file_path: stellargraph/demos/community_detection/utils.py
imports: import pandas
  import numpy
  import random
  import networkx
  from sklearn.cluster import DBSCAN
  from functools import reduce
  import matplotlib.pyplot
  import warnings
label_desc: Use image node_id 2 for calling a global function with example usage: load_network(input_data) and returns: G