Python: how to get edge’s index when indexes of two vertices are given?
you can do it using the link_edges of each vertice as input.
import bpy, bmesh

print(&quot;*&quot;*20)

def intersection(V1, V2): 
    
    if V1 != V2:
        for e in V1.link_edges: 
            if e.other_vert(V1) is V2:
                return e.index
    else:
        return -1


obj = bpy.context.edit_object
me = obj.data
bm = bmesh.from_edit_mesh(me)

if hasattr(bm.verts, &quot;ensure_lookup_table&quot;): 
    bm.verts.ensure_lookup_table()

V1 = bm.verts[0]
V2 = bm.verts[7]

print(intersection(V1, V2))