diff options
Diffstat (limited to 'developer')
-rw-r--r-- | developer/index.html | 2 | ||||
-rw-r--r-- | developer/nxeps/nxep-0004.html | 50 |
2 files changed, 26 insertions, 26 deletions
diff --git a/developer/index.html b/developer/index.html index bcb7e2b1..828a899e 100644 --- a/developer/index.html +++ b/developer/index.html @@ -493,7 +493,7 @@ <dd class="field-odd"><p>3.0rc2.dev0</p> </dd> <dt class="field-even">Date<span class="colon">:</span></dt> -<dd class="field-even"><p>Dec 15, 2022</p> +<dd class="field-even"><p>Dec 20, 2022</p> </dd> </dl> <div class="toctree-wrapper compound"> diff --git a/developer/nxeps/nxep-0004.html b/developer/nxeps/nxep-0004.html index 2fe06280..480903ba 100644 --- a/developer/nxeps/nxep-0004.html +++ b/developer/nxeps/nxep-0004.html @@ -495,7 +495,7 @@ <article class="bd-article" role="main"> <section id="nxep-4-adopting-numpy-random-generator-as-default-random-interface"> -<span id="nxep4"></span><h1>NXEP 4 — Adopting <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> as default random interface<a class="headerlink" href="#nxep-4-adopting-numpy-random-generator-as-default-random-interface" title="Permalink to this heading">#</a></h1> +<span id="nxep4"></span><h1>NXEP 4 — Adopting <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> as default random interface<a class="headerlink" href="#nxep-4-adopting-numpy-random-generator-as-default-random-interface" title="Permalink to this heading">#</a></h1> <dl class="field-list simple"> <dt class="field-odd">Author<span class="colon">:</span></dt> <dd class="field-odd"><p>Ross Barnowski (<a class="reference external" href="mailto:rossbar%40berkeley.edu">rossbar<span>@</span>berkeley<span>.</span>edu</a>)</p> @@ -515,29 +515,29 @@ <p>Pseudo-random numbers play an important role in many graph and network analysis algorithms in NetworkX. NetworkX provides a <a class="reference internal" href="../../reference/randomness.html#randomness"><span class="std std-ref">standard interface to random number generators</span></a> -that includes support for <a class="reference external" href="https://numpy.org/doc/stable/reference/random/index.html#module-numpy.random" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random</span></code></a> and the Python built-in <a class="reference external" href="https://docs.python.org/3/library/random.html#module-random" title="(in Python v3.11)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">random</span></code></a> module. -<a class="reference external" href="https://numpy.org/doc/stable/reference/random/index.html#module-numpy.random" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random</span></code></a> is used extensively within NetworkX and in several cases is the +that includes support for <a class="reference external" href="https://numpy.org/doc/stable/reference/random/index.html#module-numpy.random" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random</span></code></a> and the Python built-in <a class="reference external" href="https://docs.python.org/3/library/random.html#module-random" title="(in Python v3.11)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">random</span></code></a> module. +<a class="reference external" href="https://numpy.org/doc/stable/reference/random/index.html#module-numpy.random" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random</span></code></a> is used extensively within NetworkX and in several cases is the preferred package for random number generation. -NumPy introduced a new interface in the <a class="reference external" href="https://numpy.org/doc/stable/reference/random/index.html#module-numpy.random" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random</span></code></a> package in NumPy version +NumPy introduced a new interface in the <a class="reference external" href="https://numpy.org/doc/stable/reference/random/index.html#module-numpy.random" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random</span></code></a> package in NumPy version 1.17. According to <span class="xref std std-doc">NEP19</span>, the new interface based on -<a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> -is recommended over the legacy <a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a> as the former has +<a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> +is recommended over the legacy <a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a> as the former has <a class="reference external" href="https://www.pcg-random.org/index.html">better statistical properties</a>, <span class="xref std std-doc">more features</span>, and <span class="xref std std-doc">improved performance</span>. -This NXEP proposes a strategy for adopting <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> as the +This NXEP proposes a strategy for adopting <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> as the <strong>default</strong> interface for random number generation within NetworkX.</p> </section> <section id="motivation-and-scope"> <h2>Motivation and Scope<a class="headerlink" href="#motivation-and-scope" title="Permalink to this heading">#</a></h2> -<p>The primary motivation for adopting <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> as the default +<p>The primary motivation for adopting <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> as the default random number generation engine in NetworkX is to allow users to benefit from -the improvements in <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a>, including: +the improvements in <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a>, including: - Advances in statistical quality of modern pRNG’s - Improved performance - Additional features</p> -<p>The <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> API is very similar to the <a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a> +<p>The <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> API is very similar to the <a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a> API, so users can benefit from these improvements without any additional changes <a class="footnote-reference brackets" href="#f1" id="id1" role="doc-noteref"><span class="fn-bracket">[</span>1<span class="fn-bracket">]</span></a> to their existing NetworkX code.</p> <p>In principle this change would impact NetworkX users that use any of the @@ -565,14 +565,14 @@ See the next section for details.</p> <p>The decorator is responsible for mapping various different inputs into an instance of a random number generator within the function. Currently, the random number generator instance that is returned is a -<a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a> object:</p> +<a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a> object:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">type</span><span class="p">(</span><span class="n">foo</span><span class="p">(</span><span class="kc">None</span><span class="p">))</span> <span class="go">numpy.random.mtrand.RandomState</span> <span class="gp">>>> </span><span class="nb">type</span><span class="p">(</span><span class="n">foo</span><span class="p">(</span><span class="mi">12345</span><span class="p">))</span> <span class="go">numpy.random.mtrand.RandomState</span> </pre></div> </div> -<p>The only way to get a <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> instance from the random state +<p>The only way to get a <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> instance from the random state decorators is to pass the instance in directly:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span> <span class="gp">>>> </span><span class="n">rng</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">default_rng</span><span class="p">()</span> @@ -581,7 +581,7 @@ decorators is to pass the instance in directly:</p> </pre></div> </div> <p>This NXEP proposes to change the behavior so that when e.g. and integer or -<a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.11)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a> is given for the <code class="docutils literal notranslate"><span class="pre">seed</span></code> parameter, a <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> instance +<a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.11)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a> is given for the <code class="docutils literal notranslate"><span class="pre">seed</span></code> parameter, a <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> instance is returned instead, i.e.:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="nb">type</span><span class="p">(</span><span class="n">foo</span><span class="p">(</span><span class="kc">None</span><span class="p">))</span> <span class="go">numpy.random._generator.Generator</span> @@ -589,7 +589,7 @@ is returned instead, i.e.:</p> <span class="go">numpy.random._generator.Generator</span> </pre></div> </div> -<p><a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a> instances can still be used as <code class="docutils literal notranslate"><span class="pre">seed</span></code>, but they +<p><a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a> instances can still be used as <code class="docutils literal notranslate"><span class="pre">seed</span></code>, but they must be explicitly passed in:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">rs</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">RandomState</span><span class="p">(</span><span class="mi">12345</span><span class="p">)</span> <span class="gp">>>> </span><span class="nb">type</span><span class="p">(</span><span class="n">foo</span><span class="p">(</span><span class="n">rs</span><span class="p">))</span> @@ -606,11 +606,11 @@ thus the results of the <code class="docutils literal notranslate"><span class=" as the corresponding <code class="docutils literal notranslate"><span class="pre">RandomState</span></code> methods.</p></li> <li><p>There are a few slight differences in method names and availability between the <code class="docutils literal notranslate"><span class="pre">RandomState</span></code> and <code class="docutils literal notranslate"><span class="pre">Generator</span></code> APIs.</p></li> -<li><p>There is no global <code class="docutils literal notranslate"><span class="pre">Generator</span></code> instance internal to <a class="reference external" href="https://numpy.org/doc/stable/reference/random/index.html#module-numpy.random" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random</span></code></a> as is -the case for <a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a>.</p></li> +<li><p>There is no global <code class="docutils literal notranslate"><span class="pre">Generator</span></code> instance internal to <a class="reference external" href="https://numpy.org/doc/stable/reference/random/index.html#module-numpy.random" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random</span></code></a> as is +the case for <a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a>.</p></li> </ol> -<p>The <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> interface breaks the stream-compatibility -guarantee that <a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a> upheld of exact reproducibility of +<p>The <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> interface breaks the stream-compatibility +guarantee that <a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a> upheld of exact reproducibility of values. Switching the default random number generator from <code class="docutils literal notranslate"><span class="pre">RandomState</span></code> to <code class="docutils literal notranslate"><span class="pre">Generator</span></code> would mean functions decorated with <code class="docutils literal notranslate"><span class="pre">np_random_state</span></code> would @@ -659,18 +659,18 @@ major release, e.g. the transition from NetworkX 2.X to NetworkX 3.0.</p> <p>The second point is only a concern for users who are using <a class="reference internal" href="../../reference/generated/networkx.utils.misc.create_random_state.html#networkx.utils.misc.create_random_state" title="networkx.utils.misc.create_random_state"><code class="xref py py-obj docutils literal notranslate"><span class="pre">create_random_state</span></code></a> and the corresponding decorator <a class="reference internal" href="../../reference/generated/networkx.utils.decorators.np_random_state.html#networkx.utils.decorators.np_random_state" title="networkx.utils.decorators.np_random_state"><code class="xref py py-obj docutils literal notranslate"><span class="pre">np_random_state</span></code></a> in their own libraries. -For example, the <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generated/numpy.random.RandomState.randint.html#numpy.random.RandomState.randint" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState.randint</span></code></a> method has been replaced -by <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generated/numpy.random.Generator.integers.html#numpy.random.Generator.integers" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator.integers</span></code></a>. +For example, the <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generated/numpy.random.RandomState.randint.html#numpy.random.RandomState.randint" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState.randint</span></code></a> method has been replaced +by <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generated/numpy.random.Generator.integers.html#numpy.random.Generator.integers" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator.integers</span></code></a>. Thus any code that uses <code class="xref py py-obj docutils literal notranslate"><span class="pre">create_random_state</span></code> or <code class="xref py py-obj docutils literal notranslate"><span class="pre">create_py_random_state</span></code> and relies on the <code class="docutils literal notranslate"><span class="pre">randint</span></code> method of the returned rng would result in an <a class="reference external" href="https://docs.python.org/3/library/exceptions.html#AttributeError" title="(in Python v3.11)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">AttributeError</span></code></a>. This can be addressed with a compatiblity class similar to the <code class="xref py py-obj docutils literal notranslate"><span class="pre">networkx.utils.misc.PythonRandomInterface</span></code> class, which provides a compatibility -layer between <a class="reference external" href="https://docs.python.org/3/library/random.html#module-random" title="(in Python v3.11)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">random</span></code></a> and <a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a>.</p> +layer between <a class="reference external" href="https://docs.python.org/3/library/random.html#module-random" title="(in Python v3.11)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">random</span></code></a> and <a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a>.</p> <p><code class="xref py py-obj docutils literal notranslate"><span class="pre">create_random_state</span></code> currently returns the global <code class="docutils literal notranslate"><span class="pre">numpy.random.mtrand._rand</span></code> <code class="xref py py-obj docutils literal notranslate"><span class="pre">RandomState</span></code> instance when the input is <a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.11)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a> or the <code class="docutils literal notranslate"><span class="pre">numpy.random</span></code> module. -By switching to <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a>, this will no longer be possible as -there is no global, internal <code class="xref py py-obj docutils literal notranslate"><span class="pre">Generator</span></code> instance in the <a class="reference external" href="https://numpy.org/doc/stable/reference/random/index.html#module-numpy.random" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random</span></code></a> module. +By switching to <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a>, this will no longer be possible as +there is no global, internal <code class="xref py py-obj docutils literal notranslate"><span class="pre">Generator</span></code> instance in the <a class="reference external" href="https://numpy.org/doc/stable/reference/random/index.html#module-numpy.random" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random</span></code></a> module. This should have no effect on users, as <code class="docutils literal notranslate"><span class="pre">seed=None</span></code> currently does not guarantee reproducible results.</p> </section> @@ -678,8 +678,8 @@ guarantee reproducible results.</p> <h2>Detailed description<a class="headerlink" href="#detailed-description" title="Permalink to this heading">#</a></h2> <p>This NXEP proposes to change the default random number generator produced by the <a class="reference internal" href="../../reference/generated/networkx.utils.misc.create_random_state.html#networkx.utils.misc.create_random_state" title="networkx.utils.misc.create_random_state"><code class="xref py py-obj docutils literal notranslate"><span class="pre">create_random_state</span></code></a> function (and the related -decorator <a class="reference internal" href="../../reference/generated/networkx.utils.decorators.np_random_state.html#networkx.utils.decorators.np_random_state" title="networkx.utils.decorators.np_random_state"><code class="xref py py-obj docutils literal notranslate"><span class="pre">np_random_state</span></code></a>) from a <a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a> -instance to a <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.23)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> instance when the input to the +decorator <a class="reference internal" href="../../reference/generated/networkx.utils.decorators.np_random_state.html#networkx.utils.decorators.np_random_state" title="networkx.utils.decorators.np_random_state"><code class="xref py py-obj docutils literal notranslate"><span class="pre">np_random_state</span></code></a>) from a <a class="reference external" href="https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.RandomState</span></code></a> +instance to a <a class="reference external" href="https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator" title="(in NumPy v1.24)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">numpy.random.Generator</span></code></a> instance when the input to the function is either an integer or <a class="reference external" href="https://docs.python.org/3/library/constants.html#None" title="(in Python v3.11)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code></a>.</p> </section> <section id="related-work"> |