I have a toy example "system" that is a DAG and has 16 vertices. Suppose I have a collection of vertices "collection". How can I find all paths that passes through at least all vertices present in "collection"? The functions available all seem to work with source and target vertices but not with a collection of vertices.

My only solution up to now is rather naïve and I need to know the source and target vertex. I would like to avoid that if possible.

`g = Graph[{1 \[DirectedEdge] 2, 1 \[DirectedEdge] 3, 2 \[DirectedEdge] 6, 3 \[DirectedEdge] 7, 3 \[DirectedEdge] 8, 7 \[DirectedEdge] 9, 7 \[DirectedEdge] 10, 6 \[DirectedEdge] 11, 6 \[DirectedEdge] 12, 12 \[DirectedEdge] 13, 13 \[DirectedEdge] 14, 8 \[DirectedEdge] 10, 6 \[DirectedEdge] 10, 12 \[DirectedEdge] 15, 15 \[DirectedEdge] 16, 15 \[DirectedEdge] 17, 17 \[DirectedEdge] 14, 2 \[DirectedEdge] 12, 11 \[DirectedEdge] 16, 10 \[DirectedEdge] 16, 9 \[DirectedEdge] 16}, VertexLabels->Automatic]; collection = {1, 3, 10, 16}; HighlightGraph[g, collection, VertexLabels -> Automatic] `

Now I search for all paths between the vertices 1 and 16

`allpaths = FindPath[g, 1, 16, All, All] HighlightGraph[g, allpaths, ImageSize -> 300] `

Now I collect the possible candidates

`paths = If[ContainsAll[#, collection], #, Nothing] & /@ allpaths HighlightGraph[g, paths, ImageSize -> 300] `

As asked above are there other ways to do this WITHOUT knowing that I need paths between vertex 1 and 16?