def connect_terminals(vertices, terminals, genes):
    """
    Add the connections from *terminals* associated to the given *genes* to the
    graph *vertices*.

    Parameters
    ----------
    vertices : DataFrame
        Dataframe of the street graph plus the connection nodes.
    terminals : DataFrame
        Dataframe of the terminals to connect to the graph.
    genes : list
        List of terminal single connections of the considered configuration.

    Returns
    -------
    DataFrame
        Updated *vertices* dataframe.
    """
    tst_vertices = vertices.copy()
    n = len(tst_vertices)
    for i, a in enumerate(genes):
        terminal = terminals.iloc[i]
        tst_vertices.at[n + i, 'idA'] = terminal.name
        tst_vertices.at[n + i, 'idB'] = terminal['_id'][a]
        tst_vertices.at[n + i, 'geometry'] = terminal['_geometry'][a]
        tst_vertices.at[n + i, 'weight'] = terminal['_weight'][a]
    return tst_vertices
