A recursive implementation of the BranchPtDFS function, as defined on page 14 of the paper.

def __branch_point_dfs_recursive(u, large_n, b, stem, dfs_data):
    """A recursive implementation of the BranchPtDFS function, as defined on page 14 of the paper."""
    first_vertex = dfs_data['adj'][u][0]
    large_w = wt(u, first_vertex, dfs_data)
    if large_w % 2 == 0:
        large_w += 1
    v_I = 0
    v_II = 0
    for v in [v for v in dfs_data['adj'][u] if wt(u, v, dfs_data) <= large_w]:
        stem[u] = v # not in the original paper, but a logical extension based on page 13
        if a(v, dfs_data) == u: # uv is a tree edge
            large_n[v] = 0
            if wt(u, v, dfs_data) % 2 == 0:
                v_I = v
            else:
                b_u = b[u]
                l2_v = L2(v, dfs_data)
                #if l2_v > b_u:
                    # If this is true, then we're not on a branch at all
                #    continue
                if l2_v < b_u:
                    large_n[v] = 1
                elif b_u != 1:
                    #print stem
                    #print dfs_data['lowpoint_2_lookup']
                    #print b
                    xnode = stem[l2_v]
                    if large_n[xnode] != 0:
                        large_n[v] = large_n[xnode] + 1
                    elif dfs_data['graph'].adjacent(u, L1(v, dfs_data)):
                        large_n[v] = 2
                    else:
                        large_n[v] = large_n[u]
                if large_n[v] % 2 == 0:
                    v_II = v
                    break # Goto 1
    if v_II != 0:
        # Move v_II to head of Adj[u]
        dfs_data['adj'][u].remove(v_II)
        dfs_data['adj'][u].insert(0, v_II)
    elif v_I != 0:
        # Move v_I to head of Adj[u]
        dfs_data['adj'][u].remove(v_I)
        dfs_data['adj'][u].insert(0, v_I)
    first_time = True
    for v in dfs_data['adj'][u]:
        if a(v, dfs_data) == u:
            b[v] = u
            if first_time:
                b[v] = b[u]
            elif wt(u, v, dfs_data) % 2 == 0:
                large_n[v] = 0
            else:
                large_n[v] = 1
            stem[u] = v
            __branch_point_dfs_recursive(v, large_n, b, stem, dfs_data)
        first_time = False
    return