<｜begin▁of▁sentence｜>### Instruction:
Given an undirected graph with edges [(1, 2), (2, 3), (3, 1), (2, 4)] and unit weights, compute its algebraic connectivity using NetworkX.
### Response:
import networkx as nx

# Create an undirected graph G
G = nx.Graph()

# Add some edges
dg.add_edges_from([(1, 2), (2, 3), (3, 1), (2, 4)])

# Calculate the algebraic connectivity
alg_conn = nx.algebraic_connectivity(G, weight='weight', normalized=False, tol=1e-8, method='tracemin_pcg')

print(f'Algebraic connectivity of the graph: {alg_conn}')
<|EOT|>
