def build_adjacency_map(regs):
    'Build mapping from node IDs to child records\n    :param regs: List of `Regulation` records\n    '
    ret = collections.defaultdict(list)
    for reg in regs:
        if (reg.parent_id is not None):
            ret[reg.parent_id].append(reg)
    return ret
Build mapping from node IDs to child records
:param regs: List of `Regulation` records
def build_adjacency_map(regs):
    'Build mapping from node IDs to child records\n    :param regs: List of `Regulation` records\n    '
    ret = collections.defaultdict(list)
    for reg in regs:
        if (reg.parent_id is not None):
            ret[reg.parent_id].append(reg)
    return ret