<｜begin▁of▁sentence｜>### Instruction:
Imagine you're overseeing a portfolio of financial agreements set within a directed network, where the edges represent directional cash flow between entities. In this model, the relationships are represented as follows: there are transactions from entity 0 to entity 1, from entity 2 to entity 1, and from entity 3 to entity 4. As a loan officer assessing the structural cohesion of this financial network for potential risk exposure, how would you go about evaluating the number of separate clusters in which these entities operate, regardless of the transaction directions, using NetworkX as your analytical tool? This evaluation is crucial to understand how the default risk of one entity might impact the others.
### Response:
import networkx as nx

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

# Add edges to the graph
G.add_edges_from([(0, 1), (2, 1), (3, 4)])

# Compute the number of weakly connected components
components = nx.number_weakly_connected_components(G)
print('Number of weakly connected components:', components)
<|EOT|>
