WLJS LogoWLJS Notebook

VertexInComponentGraph

VertexInComponentGraph[g, {v1, v2, ...}] gives the subgraph of the graph g generated by the vertices that have a directed path to at least one of v1, v2, ....

VertexInComponentGraph[g, {v1, v2, ...}, k] gives the subgraph of g generated by vertices with a directed path of at most length k to at least one of v1, v2, ....

VertexInComponentGraph[g, {v1, v2, ...}, {k}] gives the subgraph of g generated by vertices of length exactly k.

VertexInComponentGraph[{v -> w, ...}, ...] uses rules v -> w to specify the graph g.

Examples

Find the in-component subgraph:

VertexInComponentGraph[Graph[{1 -> 2, 2 -> 3, 3 -> 4}], {4}]

Please visit the official Wolfram Language Reference for more details.

On this page