<｜begin▁of▁sentence｜>### Instruction:
Imagine you're evaluating a new mobile application designed for network analysis, and during the testing phase, you encounter a feature that provides users with the visualization and analysis of complex network data. You are tasked with testing the app's ability to handle a weighted directional graph with intricate relationships, including multiple edges and self-referential loops.

As part of your test case, you need to verify the app's functionality to transform this graph into a specific data structure that is efficient for storage and computation. To be precise, your current objective is to assess if the application can accurately convert the given graph into an adjacency matrix stored in a Compressed Sparse Row (CSR) format, which is a type of sparse representation ideally suited for such datasets.

The app claims to perform this conversion using a 'to_scipy_sparse_array' function from the NetworkX toolkit. The weighted edges in this graph are defined by a 'weight' attribute. For a holistic test scenario, you should ensure that the conversion preserves the edge weights faithfully in the CSR matrix.

Could you please incorporate this testing step into your routine and confirm if the application consistently generates the expected CSR format sparse array when provided with such network graphs?
### Response:
import networkx as nx

# Create a MultiDiGraph
G = nx.MultiDiGraph()

# Add weighted edges
G.add_edge(0, 1, weight=2)
G.add_edge(1, 0)
G.add_edge(2, 2, weight=3)
G.add_edge(2, 2)

# Convert to a SciPy sparse array with specified nodelist and format
S = nx.to_scipy_sparse_array(G, nodelist=[0, 1, 2], format='csr')

# Print the sparse array
print(S.toarray())
<|EOT|>
