class_docstr: This minibatch iterator iterates over batches of sampled edges or
  random pairs of co-occuring edges.
  
  G -- networkx graph
  id2idx -- dict mapping node ids to index in feature tensor
  placeholders -- tensorflow placeholders object
  context_pairs -- if not none, then a list of co-occuring node pairs (from random walks)
  batch_size -- size of the minibatches
  max_degree -- maximum size of the downsampled adjacency lists
  n2v_retrain -- signals that the iterator is being used to add new embeddings to a n2v model
  fixed_n2v -- signals that the iterator is being used to retrain n2v with only existing nodes as context
class_docstr_tok: ["This","minibatch","iterator","iterates","over","batches","of","sampled","edges","or","random","pairs","of","co-occuring","edges",".","G","--","networkx","graph","id2idx","--","dict","mapping","node","ids","to","index","in","feature","tensor","placeholders","--","tensorflow","placeholders","object","context_pairs","--","if","not","none",",","then","a","list","of","co-occuring","node","pairs","(","from","random","walks",")","batch_size","--","size","of","the","minibatches","max_degree","--","maximum","size","of","the","downsampled","adjacency","lists","n2v_retrain","--","signals","that","the","iterator","is","being","used","to","add","new","embeddings","to","a","n2v","model","fixed_n2v","--","signals","that","the","iterator","is","being","used","to","retrain","n2v","with","only","existing","nodes","as","context"]
code: def __init__(
      self,
      G,
      id2idx,
      placeholders,
      context_pairs=None,
      batch_size=100,
      max_degree=25,
      n2v_retrain=False,
      fixed_n2v=False,
      **kwargs,
  ):
      self.G = G
      self.nodes = G.nodes()
      self.id2idx = id2idx
      self.placeholders = placeholders
      self.batch_size = batch_size
      self.max_degree = max_degree
      self.batch_num = 0
  
      self.nodes = np.random.permutation(G.nodes())
      self.adj, self.deg = self.construct_adj()
      self.test_adj = self.construct_test_adj()
      if context_pairs is None:
          edges = G.edges()
      else:
          edges = context_pairs
      self.train_edges = self.edges = np.random.permutation(edges)
      if not n2v_retrain:
          self.train_edges = self._remove_isolated(self.train_edges)
          self.val_edges = [
              e for e in G.edges() if G[e[0]][e[1]]["train_removed"]
          ]
      else:
          if fixed_n2v:
              self.train_edges = self.val_edges = self._n2v_prune(
                  self.edges
              )
          else:
              self.train_edges = self.val_edges = self.edges
  
      print(
          len(
              [
                  n
                  for n in G.nodes()
                  if not G.node[n]["test"] and not G.node[n]["val"]
              ]
          ),
          "train nodes",
      )
      print(
          len(
              [
                  n
                  for n in G.nodes()
                  if G.node[n]["test"] or G.node[n]["val"]
              ]
          ),
          "test nodes",
      )
      self.val_set_size = len(self.val_edges)
  
imports: from __future__ import division
  from __future__ import print_function
  import numpy
label_desc: Use image node_id 1 to create a new EdgeMinibatchIterator object from inherited base classes: object with example: obj = EdgeMinibatchIterator(G, id2idx, placeholders, context_pairs, batch_size, max_degree, n2v_retrain, fixed_n2v)