<｜begin▁of▁sentence｜>### Instruction:
Given a weighted undirected graph with the edge set [(1, 2, 10), (2, 3, 20), (3, 4, 30), (4, 1, 40)], how can we represent this graph as an adjacency matrix using NetworkX?
### Response:
import networkx as nx
from scipy.sparse import csr_matrix

# Create a NetworkX graph
G = nx.Graph()
G.add_weighted_edges_from([(1, 2, 10), (2, 3, 20), (3, 4, 30), (4, 1, 40)])

# Get the adjacency matrix
A = nx.adjacency_matrix(G)
print(A.todense())
<|EOT|>
