<｜begin▁of▁sentence｜>### Instruction:
Given a directed graph with the edge set [(0, 1), (2, 1)], and an isolated node 3, can you check if the graph is weakly connected using NetworkX? What if you add an edge from node 2 to node 3?
### Response:
import networkx as nx

# Create a directed graph
G = nx.DiGraph()

# Add edges to the graph (creating nodes in the process)
G.add_edge(0, 1)
G.add_edge(2, 1)
G.add_node(3)

# Check if the graph is weakly connected
is_connected = nx.is_weakly_connected(G)
print('Graph is weakly connected:', is_connected)

# Add an edge that includes the isolated node
G.add_edge(2, 3)

# Check again if the graph is weakly connected
is_connected = nx.is_weakly_connected(G)
print('Graph is weakly connected after adding an edge:', is_connected)
<|EOT|>
