<｜begin▁of▁sentence｜>### Instruction:
Imagine we're conducting an experiment in a simulation of the cosmos where we've scattered 30 celestial bodies within a contained sector, the equivalent of our unit square. Each body carries a certain mass that follows an underlying exponential distribution, reflective of diverse celestial masses in the universe. We are interested in modeling a cosmic web, akin to a random geometric graph, where these bodies are influenced by forces which require them to be within a certain proximity threshold (0.2 in our normalized space scale) and have their combined masses exceed a critical value (0.1 in our mass scale) for a gravitational bond to be established. How might we represent this celestial network while adhering to these spatial and mass criteria to discern which bodies are destined to interact within this cosmic landscape?
### Response:
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt

# Seed for reproducibility
seed = 42

# Set random number generator
rng = np.random.default_rng(seed)

# Parameters
n = 30  # Number of nodes
radius = 0.2  # Distance threshold
theta = 0.1  # Threshold value
dim = 2  # Dimension of graph

# Generating node positions
pos = {i: rng.random(dim) for i in range(n)}

# Weights from a exponential distribution with rate parameter lambda=3
weights = {i: rng.exponential(3) for i in range(n)}

# Create a thresholded random geometric graph
G = nx.thresholded_random_geometric_graph(n, radius, theta, dim=dim, pos=pos, weight=weights, seed=seed)

# Draw the graph
nx.draw(G, pos, node_size=50, node_color='blue', with_labels=True)
plt.show()
<|EOT|>
