def __calculate_bu_dfs_recursively(u, b, dfs_data):
    """Calculates the b(u) lookup table with a recursive DFS."""
    first_time = True
    for v in dfs_data['adj'][u]:
        if a(v, dfs_data) == u:
            if first_time:
                b[v] = b[u]
            else:
                b[v] = D(u, dfs_data)
            __calculate_bu_dfs_recursively(v, b, dfs_data)
        first_time = False
def __calculate_bu_dfs_recursively ( u , b , dfs_data ) : first_time = True for v in dfs_data [ 'adj' ] [ u ] : if a ( v , dfs_data ) == u : if first_time : b [ v ] = b [ u ] else : b [ v ] = D ( u , dfs_data ) __calculate_bu_dfs_recursively ( v , b , dfs_data ) first_time = False
Calculates the b(u) lookup table with a recursive DFS.