GitHub

Original file line numberDiff line numberDiff line change

@@ -464,10 +464,10 @@ Here's some example code that generates and plots a random graph, with node colo

464464

```{code-cell} ipython

465465

import networkx as nx

466466

import matplotlib.pyplot as plt

467-

np.random.seed(1234)

467+

rng = np.random.default_rng(1234)

468468
469469

# Generate a random graph

470-

p = dict((i, (np.random.uniform(0, 1), np.random.uniform(0, 1)))

470+

p = dict((i, (rng.uniform(0, 1), rng.uniform(0, 1)))

471471

for i in range(200))

472472

g = nx.random_geometric_graph(200, 0.12, pos=p)

473473

pos = nx.get_node_attributes(g, 'pos')

Read the original on github.com ↗