for edge in graph.es:
    source_vertex_id = edge.source
target_vertex_id = edge.target
source_vertex = graph.vs[source_vertex_id]
target_vertex = graph.vs[target_vertex_id]
How to get the vertices from an edge using igraph in python?