<｜begin▁of▁sentence｜>### Instruction:
Given a graph which you can read from graph_data.gml, can you use the connected_components function in igraph to calculate the weakly connected components of the graph? Notes: You need to print the components.
### Response:
from igraph import Graph

# Reading the graph from a file
g = Graph.Read_GML('graph_data.gml')

# Calculate the connected components
components = g.connected_components(mode='weak')

# Print the result - each component is a list of vertex ids
for component in components:
    print(component)
<|EOT|>
