# How to get a list of vertices from a list of edges in bmesh?

So if I have a list of edges,

selected_edges = [e for e in bm.edges if e.select]


How would I make an array of the vertices contained in the edges of that list?

For context: in my project I'm making a list of shared vertices between two lists of edges.

Use sets.

Will most likely be duplicates in the following vertex list, from any connected edges.

selected_verts = [v for e in bm.edges if e.select for v in e.verts]


Converting to set(...) will have only one member for each vertex.

 set(selected_verts)


or defining as set in first place.

selected_verts = {v for e in bm.edges if e.select for v in e.verts}


The set(...) sounds like the way go as you can check intersection between sets of vertices easily.

between sets.