Use this if you are using igraph from R
Intersection of vertex sequences
## S3 method for class 'igraph.vs' intersection(...)
The vertex sequences to take the intersection of.
They must belong to the same graph. Note that this function has ‘set’ semantics and the multiplicity of vertices is lost in the result.
A vertex sequence that contains vertices that appear in all given sequences, each vertex exactly once.
Other vertex and edge sequence operations:
g <- make_(ring(10), with_vertex_(name = LETTERS[1:10])) intersection(E(g)[1:6], E(g)[5:9])