# inducedSubgraph -- A method for finding the induced subgraph of any Graph or Digraph

## Synopsis

• Usage:
H = inducedSubgraph(G, L)
D' = inducedSubgraph(D, L)
• Inputs:
• G, an instance of the type Graph,
• D, an instance of the type Digraph,
• L, a list, This list should contain vertices of G
• Outputs:
• H, an instance of the type Graph,
• D', an instance of the type Digraph, The subgraph induced by removing the vertices in L

## Description

This method takes a graph or digraph and a list as the inputs. The List should be the vertices of the subgraph the user wants to consider, and the output will contain just those vertices and any edges from G that connect them. This method also is a way of iterating deleteVertex several times in a quick way.

 i1 : G = completeGraph 5 o1 = Graph{0 => {1, 2, 3, 4}} 1 => {0, 2, 3, 4} 2 => {0, 1, 3, 4} 3 => {0, 1, 2, 4} 4 => {0, 1, 2, 3} o1 : Graph i2 : S = {3,4} o2 = {3, 4} o2 : List i3 : inducedSubgraph(G,S) o3 = Graph{3 => {4}} 4 => {3} o3 : Graph i4 : D = digraph ({{1,2},{2,3},{3,4},{4,1},{2,4}},EntryMode=>"edges"); i5 : D' = inducedSubgraph(D,{1,2,4}) o5 = Digraph{1 => {2}} 2 => {4} 4 => {1} o5 : Digraph