<｜begin▁of▁sentence｜>### Instruction:
Using NetworkX, how can we generate a degree sequence that can form a tree with power-law distribution, given the number of nodes as 10, exponent of the power-law as 3.0, with a random seed of 42, and a maximum of 1000 tries for the sequence to be valid?
### Response:
import networkx as nx
from networkx.utils import powerlaw_sequence

# Parameters
gamma = 3.0 # Exponent of the power-law.n = 10 # Number of nodes.seed = 42 # Seed for the random number generator.tries = 1000 # Number of attempts to get a valid sequence.

# Generate a power-law tree sequence
sequence = nx.random_powerlaw_tree_sequence(n, gamma=gamma, seed=seed, tries=tries)
print('Generated power-law tree sequence:', sequence)

# Creating the graph from the sequence
G = nx.configuration_model(sequence)
# Convert to a simple graph to remove parallel edges and self loopsG = nx.Graph(G)
# Remove self-loops and parallel edgesG.remove_edges_from(nx.selfloop_edges(G))
<|EOT|>
