<｜begin▁of▁sentence｜>### Instruction:
Given a graph with edge set [(1, 2), (2, 3), (1, 3), (4, 5)], how can you calculate its Laplacian matrix using NetworkX, which represents the matrix L = D - A, where A is the adjacency matrix, D is the diagonal matrix of node degrees, and the edge weights are summed if the graph has multiple edges?
### Response:
import networkx as nx
# Create a graph
G = nx.Graph()
# Add edges
G.add_edges_from([(1, 2), (2, 3), (1, 3), (4, 5)])
# Calculate the Laplacian matrix
L = nx.laplacian_matrix(G).toarray()
print('Laplacian matrix:')
print(L)
<|EOT|>
