class_docstr: Class defining categorical distribution type functionality
docstr: Collapse categories into one column through summation.
  Conceptually the same as modify_h.
  
  Args:
      adj: The adjacency matrix.
  
  Returns:
      Updated adjacency matrix.
docstr_tok: ["Collapse","categories","into","one","column","through","summation",".","Conceptually","the","same","as","modify_h",".","Args",":","adj",":","The","adjacency","matrix",".","Returns",":","Updated","adjacency","matrix","."]
code: def collapse_adj(self, adj: np.ndarray) -> np.ndarray:
      """
      Collapse categories into one column through summation.
      Conceptually the same as modify_h.
  
      Args:
          adj: The adjacency matrix.
  
      Returns:
          Updated adjacency matrix.
      """
      orig_idx = self.idx_group[0]
      expand_idx = self.idx_group[1:]
  
      # Add on the edges from expanded nodes.
      adj[orig_idx, :] = adj[orig_idx, :] + np.sum(
          adj[expand_idx, :], axis=0
      )
      # Add on the edges to expanded nodes.
      adj[:, orig_idx] = adj[:, orig_idx] + np.sum(
          adj[:, expand_idx], axis=1
      )
  
      return adj
  
imports: from copy import deepcopy
  from typing import Dict, List, Tuple
  import numpy
  import torch
  from sklearn.preprocessing import OneHotEncoder
  from torch import nn
  from causalnex.structure.pytorch.dist_type._base import DistTypeBase, ExpandColumnsMixin
  from causalnex.structure.structuremodel import StructureModel
label_desc: Use image node_id 6 for calling the DistTypeCategorical obj's underlying member method code with example usage: obj.collapse_adj(adj) and returns: adj