code: def from_epgm(epgm_location, dataset_name=None, directed=False):
      """
      Imports a graph stored in EPGM format to a NetworkX object
  
      Args:
          epgm_location (str): The directory containing the EPGM data
          dataset_name (str), optional: The name of the dataset to import
          directed (bool): If True, load as a directed graph, otherwise
              load as an undirected graph
  
      Returns:
          A NetworkX graph containing the data for the EPGM-stored graph.
      """
      G_epgm = EPGM(epgm_location)
      graphs = G_epgm.G["graphs"]
  
      # if dataset_name is not given, use the name of the 1st graph head
      if not dataset_name:
          dataset_name = graphs[0]["meta"]["label"]
          warnings.warn(
              "dataset name not specified, using dataset '{}' in the 1st graph head".format(
                  dataset_name
              ),
              RuntimeWarning,
              stacklevel=2,
          )
  
      # Select graph using dataset_name
      for g in graphs:
          if g["meta"]["label"] == dataset_name:
              graph_id = g["id"]
  
      # Convert to StellarGraph (via nx)
      Gnx = G_epgm.to_nx(graph_id, directed=directed)
  
      print(
          "Graph statistics: {} nodes, {} edges".format(
              Gnx.number_of_nodes(), Gnx.number_of_edges()
          )
      )
      return Gnx
  
file_path: stellargraph/stellargraph/data/loader.py
imports: import os
  import warnings
  import pandas
  import networkx
  from stellargraph.data.epgm import EPGM
  from stellargraph.core.graph import *
  from stellargraph import globalvar
label_desc: Use image node_id 1 for calling a global function with example usage: from_epgm(epgm_location, dataset_name, directed) and returns: Gnx