<｜begin▁of▁sentence｜>### Instruction:
Given a graph which you can read from graph_data.gml, can you use igraph's subcomponent function to determine the subcomponent associated with a vertex with index 2 in different modes (in, out, all)?
### Response:
from igraph import Graph

# Load graph from file
g = Graph.Read_GML('graph_data.gml')

# Get the subcomponent of vertex 2 including vertices that can reach vertex 2
subcomponent_in = g.subcomponent(2, mode='in')

# Get the subcomponent of vertex 2 including vertices reachable from vertex 2
subcomponent_out = g.subcomponent(2, mode='out')

# Get all vertices in the same weakly connected component as vertex 2
subcomponent_all = g.subcomponent(2, mode='all')

# Print the vertices of the subcomponents
print('In subcomponent:', subcomponent_in)
print('Out subcomponent:', subcomponent_out)
print('All subcomponent:', subcomponent_all)
<|EOT|>
