class_docstr: Symmetric Stochastic Block Model Mixture
  
  Reference: Appendix C of `Supervised Community Detection with Hierarchical Graph Neural Networks <https://arxiv.org/abs/1705.08415>`_
  
  Parameters
  ----------
  n_graphs : int
      Number of graphs.
  n_nodes : int
      Number of nodes.
  n_communities : int
      Number of communities.
  k : int, optional
      Multiplier. Default: 2
  avg_deg : int, optional
      Average degree. Default: 3
  pq : list of pair of nonnegative float or str, optional
      Random densities. This parameter is for future extension,
      for now it's always using the default value.
      Default: Appendix_C
  rng : numpy.random.RandomState, optional
      Random number generator. If not given, it's numpy.random.RandomState() with `seed=None`,
      which read data from /dev/urandom (or the Windows analogue) if available or seed from
      the clock otherwise.
      Default: None
  
  Raises
  ------
  RuntimeError is raised if pq is not a list or string.
  
  Examples
  --------
  >>> data = SBMMixtureDataset(n_graphs=16, n_nodes=10000, n_communities=2)
  >>> from torch.utils.data import DataLoader
  >>> dataloader = DataLoader(data, batch_size=1, collate_fn=data.collate_fn)
  >>> for graph, line_graph, graph_degrees, line_graph_degrees, pm_pd in dataloader:
  ...     # your code here
docstr: The `collate` function for dataloader
  
  Parameters
  ----------
  x : tuple
      a batch of data that contains:
  
      - graph: :class:`dgl.DGLGraph`
          The original graph
      - line_graph: :class:`dgl.DGLGraph`
          The line graph of `graph`
      - graph_degree: numpy.ndarray
          In degrees for each node in `graph`
      - line_graph_degree: numpy.ndarray
          In degrees for each node in `line_graph`
      - pm_pd: numpy.ndarray
          Edge indicator matrices Pm and Pd
  
  Returns
  -------
  g_batch: :class:`dgl.DGLGraph`
      Batched graphs
  lg_batch: :class:`dgl.DGLGraph`
      Batched line graphs
  degg_batch: numpy.ndarray
      A batch of in degrees for each node in `g_batch`
  deglg_batch: numpy.ndarray
      A batch of in degrees for each node in `lg_batch`
  pm_pd_batch: numpy.ndarray
      A batch of edge indicator matrices Pm and Pd
docstr_tok: ["The","`","collate","`","function","for","dataloader","Parameters","--","--","--","--","--","x",":","tuple","a","batch","of","data","that","contains",":","-","graph",":",":","class",":","`","dgl.DGLGraph","`","The","original","graph","-","line_graph",":",":","class",":","`","dgl.DGLGraph","`","The","line","graph","of","`","graph","`","-","graph_degree",":","numpy.ndarray","In","degrees","for","each","node","in","`","graph","`","-","line_graph_degree",":","numpy.ndarray","In","degrees","for","each","node","in","`","line_graph","`","-","pm_pd",":","numpy.ndarray","Edge","indicator","matrices","Pm","and","Pd","Returns","--","--","--","-","g_batch",":",":","class",":","`","dgl.DGLGraph","`","Batched","graphs","lg_batch",":",":","class",":","`","dgl.DGLGraph","`","Batched","line","graphs","degg_batch",":","numpy.ndarray","A","batch","of","in","degrees","for","each","node","in","`","g_batch","`","deglg_batch",":","numpy.ndarray","A","batch","of","in","degrees","for","each","node","in","`","lg_batch","`","pm_pd_batch",":","numpy.ndarray","A","batch","of","edge","indicator","matrices","Pm","and","Pd"]
code: def collate_fn(self, x):
      r"""The `collate` function for dataloader
  
      Parameters
      ----------
      x : tuple
          a batch of data that contains:
  
          - graph: :class:`dgl.DGLGraph`
              The original graph
          - line_graph: :class:`dgl.DGLGraph`
              The line graph of `graph`
          - graph_degree: numpy.ndarray
              In degrees for each node in `graph`
          - line_graph_degree: numpy.ndarray
              In degrees for each node in `line_graph`
          - pm_pd: numpy.ndarray
              Edge indicator matrices Pm and Pd
  
      Returns
      -------
      g_batch: :class:`dgl.DGLGraph`
          Batched graphs
      lg_batch: :class:`dgl.DGLGraph`
          Batched line graphs
      degg_batch: numpy.ndarray
          A batch of in degrees for each node in `g_batch`
      deglg_batch: numpy.ndarray
          A batch of in degrees for each node in `lg_batch`
      pm_pd_batch: numpy.ndarray
          A batch of edge indicator matrices Pm and Pd
      """
      g, lg, deg_g, deg_lg, pm_pd = zip(*x)
      g_batch = batch.batch(g)
      lg_batch = batch.batch(lg)
      degg_batch = np.concatenate(deg_g, axis=0)
      deglg_batch = np.concatenate(deg_lg, axis=0)
      pm_pd_batch = np.concatenate(
          [x + i * self._n_nodes for i, x in enumerate(pm_pd)], axis=0
      )
      return g_batch, lg_batch, degg_batch, deglg_batch, pm_pd_batch
  
imports: import math
  import os
  import random
  import numpy
  import numpy.random
  import scipy
  from ..None import batch
  from ..convert import from_scipy
  from .dgl_dataset import DGLDataset
  from .utils import load_graphs, load_info, save_graphs, save_info
label_desc: Use image node_id 12 for calling the SBMMixtureDataset obj's underlying member method code with example usage: obj.collate_fn(x) and returns: g_batch,  lg_batch,  degg_batch,  deglg_batch,  pm_pd_batch