I believe I found a robust way to do it:
Subgraph[g, Verbatim /@ vs]
The problem is that it kills performance.
rg = RandomGraph[{10000, 30000}];
vs = RandomSample[VertexList[rg], 100];
Subgraph[rg, vs]; // RepeatedTiming
(* {0.00024, Null} *)
Subgraph[rg, Verbatim /@ vs]; // RepeatedTiming
(* {5.14, Null} *)
Thus is it not really a practically usable solution.
I think that a workable fix would be to always interpret a List
-second argument as a list in Subgraph
(and never as a single vertex or single pattern). Thus the single-vertex syntax, Subgraph[g, v]
would still be problematic, but at least the Subgraph[g, {v1, v2, ...}]
syntax would always be unambiguous.
This, however, would become a usability problem with VertexDelete
where people will use the single-vertex syntax much more frequently.