code: def get_graph_elements(graph_, n_epochs):
      """
      gets elements of graphs, weights, and number of epochs per edge
  
      Parameters
      ----------
      graph_ : scipy.sparse.csr.csr_matrix
          umap graph of probabilities
      n_epochs : int
          maximum number of epochs per edge
  
      Returns
      -------
      graph scipy.sparse.csr.csr_matrix
          umap graph
      epochs_per_sample np.array
          number of epochs to train each sample for
      head np.array
          edge head
      tail np.array
          edge tail
      weight np.array
          edge weight
      n_vertices int
          number of vertices in graph
      """
      ### should we remove redundancies () here??
      # graph_ = remove_redundant_edges(graph_)
  
      graph = graph_.tocoo()
      # eliminate duplicate entries by summing them together
      graph.sum_duplicates()
      # number of vertices in dataset
      n_vertices = graph.shape[1]
      # get the number of epochs based on the size of the dataset
      if n_epochs is None:
          # For smaller datasets we can use more epochs
          if graph.shape[0] <= 10000:
              n_epochs = 500
          else:
              n_epochs = 200
      # remove elements with very low probability
      graph.data[
          graph.data < (graph.data.max() / float(n_epochs))
      ] = 0.0
      graph.eliminate_zeros()
      # get epochs per sample based upon edge probability
      epochs_per_sample = n_epochs * graph.data
  
      head = graph.row
      tail = graph.col
      weight = graph.data
  
      return graph, epochs_per_sample, head, tail, weight, n_vertices
  
imports: import numpy
  from umap import UMAP
  from warnings import warn, catch_warnings, filterwarnings
  from numba import TypingError
  import os
  from umap.spectral import spectral_layout
  from sklearn.utils import check_random_state
  import codecs, pickle
  from sklearn.neighbors import KDTree
  import sys
label_desc: Use image node_id 1 for calling a global function with example usage: get_graph_elements(graph_, n_epochs) and returns: graph,  epochs_per_sample,  head,  tail,  weight,  n_vertices