def edgelist_from_synapse_df(syn_df,
                             pre_column='pre_pt_root_id',
                             post_column='post_pt_root_id',
                             weight_column='size',
                             agg='count'):
    """Compute a list of pre to post edges from a synapse-query-style dataframe. Defaults to counting  synapses.

    Parameters
    ----------
    syn_df : pandas.DataFrame 
        DataFrame with columns for pre id, post id, and at least one additional column to use as weight. 
    pre_column : str, optional
        Column name of the presynaptic ids, by default 'pre_pt_root_id'
    post_column : str, optional
        Column name of the postsynaptic ids, by default 'pre_pt_root_id'
    weight_column : str, optional
        Column name for values to be aggregated, by default 'size''
    agg : str, optional
        Argument for the pandas groupby aggregation function, by default 'count'. Set to `sum` for using net synapse size instead.

    Returns
    -------
    pandas.DataFrame
        DataFrame with pre, post, and weight columns and a row for each edge in graph.
    """
    syn_gb = syn_df.groupby([pre_column, post_column])
    edge_list_wide = syn_gb.agg(agg).reset_index()    
    edge_list = edge_list_wide[[pre_column, post_column, weight_column]].rename(columns={weight_column: 'weight'})
    return edge_list