Thanks for your reply Moritz.
If I do that however, and if any of the nodes in my set(lets call it set A) of 1000 nearby nodes are not connected directly or via nodes in the set A, then the set of edges between those nodes is not selected. What I am trying to do is get an efficient way to get convex set of a subset of vertices in a graph.
Any node would be in the convex set of a set of nodes=Vsubset if it lies on the shortest path between any two nodes in Vsubset. A node outside Vsubset may also be in the convex set of Vsubset.