<｜begin▁of▁sentence｜>### Instruction:
Given a directed graph with nodes [0, 1, 2, 3, 4, 5] and edges [(0, 1), (1, 2), (2, 3), (3, 4), (4, 0), (4, 5)], how can you use the connected_components method in igraph to find and print both the strongly and weakly connected components in the graph?
### Response:
import igraph as ig

# Create a directed graph
g = ig.Graph([(0, 1), (1, 2), (2, 3), (3, 4), (4, 0), (4, 5)], directed=True)

# Calculate the strongly connected components
strongly_connected = g.connected_components(mode='strong')

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

# Print the results
print('Strongly connected components:', strongly_connected)
print('Weakly connected components:', weakly_connected.subgraphs())
<|EOT|>
