def get_lineage_topo_dict(relations_list):
    """
    记录每一个节点的parents、children、指向该节点的线和指出该节点的线
    :param relations_list: 血缘接口返回的边
    :return:
    """
    topo_dict = {}
    for each_relation in relations_list:
        child = each_relation['to']
        parent = each_relation['from']
        if child not in topo_dict:
            topo_dict[child] = {'from_relation': [], 'to_relation': [], 'parents': [], 'children': []}
        if parent not in topo_dict:
            topo_dict[parent] = {'from_relation': [], 'to_relation': [], 'parents': [], 'children': []}
        # 记录箭头指向某一节点的线
        topo_dict[child]['to_relation'].append(each_relation)
        topo_dict[child]['parents'].append(parent)
        # 记录箭头指出某一节点的线
        topo_dict[parent]['from_relation'].append(each_relation)
        topo_dict[parent]['children'].append(child)
    return topo_dict