def _get_edge_colors(G, path, colors):
    """For each edge, assign color based on membership in path_edges."""
    path_edges = [(path[i], path[i + 1]) for i in range(len(path) - 1)]
    edge_colors = []
    for x in G.edges:
        if x in path_edges:
            edge_colors.append(colors['active'])
        else:
            edge_colors.append(colors['inactive_edge'])
    return edge_colors