<jupyter_start><jupyter_text>Genealogical Tree<jupyter_code>class Edge:
    def __init__(self, vertex, weight):
        self.vertex=vertex
        self.weight=weight

def topoSort(G):
    n=len(G)
    inDegree={vertex: 0 for vertex in G.keys()}
    queue=[]
    
    for vertex in G.keys():
        for edge in G[vertex]:
            inDegree[edge.vertex]+=1
    for v in inDegree.keys():
        if inDegree[v]==0:
            queue.append(v)
            
    sequence=[]
    while queue:
        k=queue.pop(0)
        sequence.append(k)
        for e in G[k]:
            inDegree[e.vertex] -= 1
            if inDegree[e.vertex] == 0:
                queue.append(e.vertex)
                
    if len(sequence)==n:
        return sequence
    else:
        return None<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11830635118306351, 'fraction_numerical': 0.007471980074719801, 'mean_word_length': 1.8210526315789475, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '622679', 'license': 'MIT', 'n_tokens_mistral': 281, 'n_tokens_neox': 269, 'n_words': 57, 'path': 'Guowei/Week9/Week9.ipynb', 'repo_name': 'PKUfudawei/Data-Structure-Algorithm', 'size': '803'}