Find faces that contain a given edge

Hi, all.

Is there any functionality that allows me to find all faces that contain a given edge? I mean the most obvious and most costly way is go through all faces, but in my case that’s 350k faces and thousands of edges to go through, so it will take a while.

Thanks in advance,
Denis.

If you work with Bmesh. You can get the faces connected only by edge.link_faces

Ex:

import bpy, bmesh

obj = bpy.context.active_object
bm = bmesh.from_edit_mesh(obj.data)


edge = bm.edges[0]


print(edge.link_faces[:])

That’s exactly what I need.

Thanks!