class_docstr: Generates random internet AS graphs.
class_docstr_tok: ["Generates","random","internet","AS","graphs","."]
docstr: Add a peering link between two middle tier (M) nodes.
  
  Target node j is drawn considering a preferential attachment based on
  other M node peering degree.
  
  Parameters
  ----------
  m: object
      Node identifier
  to_kind: string
      type for target node j (must be always M)
  
  Returns
  -------
  success: boolean
docstr_tok: ["Add","a","peering","link","between","two","middle","tier","(","M",")","nodes",".","Target","node","j","is","drawn","considering","a","preferential","attachment","based","on","other","M","node","peering","degree",".","Parameters","--","--","--","--","--","m",":","object","Node","identifier","to_kind",":","string","type","for","target","node","j","(","must","be","always","M",")","Returns","--","--","--","-","success",":","boolean"]
code: def add_m_peering_link(self, m, to_kind):
      """Add a peering link between two middle tier (M) nodes.
  
      Target node j is drawn considering a preferential attachment based on
      other M node peering degree.
  
      Parameters
      ----------
      m: object
          Node identifier
      to_kind: string
          type for target node j (must be always M)
  
      Returns
      -------
      success: boolean
      """
  
      # candidates are of type 'M' and are not customers of m
      node_options = self.nodes["M"].difference(self.customers[m])
      # candidates are not providers of m
      node_options = node_options.difference(self.providers[m])
      # remove self
      if m in node_options:
          node_options.remove(m)
  
      # remove candidates we are already connected to
      for j in self.G.neighbors(m):
          if j in node_options:
              node_options.remove(j)
  
      if len(node_options) > 0:
          j = self.choose_peer_pref_attach(node_options)
          self.add_edge(m, j, "peer")
          self.G.nodes[m]["peers"] += 1
          self.G.nodes[j]["peers"] += 1
          return True
      else:
          return False
  
file_path: networkx/networkx/generators/internet_as_graphs.py
imports: import networkx
  from networkx.utils import py_random_state
label_desc: Use image node_id 8 for calling the AS_graph_generator obj's underlying member method code with example usage: obj.add_m_peering_link(m, to_kind) and returns: True, False