<｜begin▁of▁sentence｜>### Instruction:
Imagine you're advising a philanthropic organization that wants to visualize and analyze their network of charitable impacts. They have three key initiatives—let's call them Initiative A, Initiative B, and Initiative C. Each initiative has been allocated funding, corresponding to their 'size' in importance or investment: Initiative A with $5 million, Initiative B with $10 million, and Initiative C with $5 million.

The organization's impact is not just in these initiatives, but how they are connected. Initiatives A and B have collaborated on a project that required a $2 million investment, and initiatives B and C have also worked together on a different endeavor, with a $3 million investment.

To help them strategize and assess their network effectively, they are looking to create a customized matrix that captures these relationships. They want this matrix to reflect the 'size' (the investment) of each initiative and the 'weight' (collaborative investment) of the connections between them.

How would you reformulate their network into an attribute sparse matrix, ensuring the size of each initiative is represented in the order of their investments—$5 million, $10 million, and $5 million—just as listed, while also incorporating the weighted collaborative investments? This matrix will be crucial for the organization to visualize and quantify the interconnected nature of their initiatives.
### Response:
import networkx as nx
from scipy.sparse import coo_matrix

G = nx.Graph()
G.add_edge('a', 'b', weight=2)
G.add_edge('b', 'c', weight=3)
G.add_node('a', size=5)
G.add_node('b', size=10)
G.add_node('c', size=5)

M, ordering = nx.attr_sparse_matrix(G, node_attr='size', edge_attr='weight', rc_order=[5, 10, 5])
M_dense = M.toarray()
print('Matrix:\n', M_dense)
print('Ordering:', ordering)
<|EOT|>
