<｜begin▁of▁sentence｜>### Instruction:
I'd like to model a network where new connections are preferentially made to popular nodes, but with a twist: sometimes the new nodes form two connections, sometimes three, and the choice is random based on a given probability. The network should have 100 nodes, and the choice to form two or three connections should be 50/50. Can I do this with NetworkX?
### Response:
import networkx as nx

# Parameters for the dual Barabási–Albert graph
n = 100  # Number of nodes
m1 = 2   # Number of edges to attach from a new node to existing nodes with probability p
m2 = 3   # Number of edges to attach from a new node to existing nodes with probability 1-p
p = 0.5  # Probability of attaching m1 edges (otherwise m2 edges)
seed = 42  # Seed for random number generator

# Create the random graph using the dual Barabási–Albert model
G = nx.dual_barabasi_albert_graph(n, m1, m2, p, seed=seed)

# You can now use G as a normal NetworkX graph. For example, to get the node degree
print(dict(G.degree()))
<|EOT|>
