def route_to_gdf(
    G: nx.MultiDiGraph,
    route: list[int],
    *,
    weight: str = "length",
) -> gpd.GeoDataFrame:
    """
    Return a GeoDataFrame of the edges in a path, in order.

    Parameters
    ----------
    G
        Input graph.
    route
        Node IDs constituting the path.
    weight
        Attribute value to minimize when choosing between parallel edges.

    Returns
    -------
    gdf_edges
        The ordered edges in the path.
    """
    pairs = zip(route[:-1], route[1:])
    uvk = ((u, v, min(G[u][v].items(), key=lambda i: i[1][weight])[0]) for u, v in pairs)
    return convert.graph_to_gdfs(G.subgraph(route), nodes=False).loc[uvk]

    Return a GeoDataFrame of the edges in a path, in order.

    Parameters
    ----------
    G
        Input graph.
    route
        Node IDs constituting the path.
    weight
        Attribute value to minimize when choosing between parallel edges.

    Returns
    -------
    gdf_edges
        The ordered edges in the path.
    
osmnx/routing.py