From 0a114ae30bece92b80880d99fe156ce418796d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paula=20P=C3=A9rez=20Bianchi?= <44149844+paulitapb@users.noreply.github.com> Date: Tue, 21 Mar 2023 05:48:16 -0300 Subject: Update docstring of paley graph (#6529) * Add warning in community doc * fix unwanted change * Add latex formatting * let pre-commit add double backslashes * Update networkx/generators/expanders.py Co-authored-by: Dan Schult * Update networkx/generators/expanders.py Co-authored-by: Dan Schult * format docstring as raw to use normal latex --------- Co-authored-by: Dan Schult --- networkx/generators/expanders.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'networkx') diff --git a/networkx/generators/expanders.py b/networkx/generators/expanders.py index c48620dd..aac8c109 100644 --- a/networkx/generators/expanders.py +++ b/networkx/generators/expanders.py @@ -146,19 +146,19 @@ def chordal_cycle_graph(p, create_using=None): def paley_graph(p, create_using=None): - """Returns the Paley $\\frac{(p-1)}{2}$ -regular graph on $p$ nodes. + r"""Returns the Paley $\frac{(p-1)}{2}$ -regular graph on $p$ nodes. - The returned graph is a graph on $\\mathbb{Z}/p\\mathbb{Z}$ with edges between $x$ and $y$ - if and only if $x-y$ is a nonzero square in $\\mathbb{Z}/p\\mathbb{Z}$. + The returned graph is a graph on $\mathbb{Z}/p\mathbb{Z}$ with edges between $x$ and $y$ + if and only if $x-y$ is a nonzero square in $\mathbb{Z}/p\mathbb{Z}$. - If $p \\equiv 1 \\pmod 4$, $-1$ is a square in $\\mathbb{Z}/p\\mathbb{Z}$ and therefore $x-y$ is a square if and + If $p \equiv 1 \pmod 4$, $-1$ is a square in $\mathbb{Z}/p\mathbb{Z}$ and therefore $x-y$ is a square if and only if $y-x$ is also a square, i.e the edges in the Paley graph are symmetric. - If $p \\equiv 3 \\pmod 4$, $-1$ is not a square in $\\mathbb{Z}/p\\mathbb{Z}$ and therefore either $x-y$ or $y-x$ - is a square in $\\mathbb{Z}/p\\mathbb{Z}$ but not both. + If $p \equiv 3 \pmod 4$, $-1$ is not a square in $\mathbb{Z}/p\mathbb{Z}$ and therefore either $x-y$ or $y-x$ + is a square in $\mathbb{Z}/p\mathbb{Z}$ but not both. Note that a more general definition of Paley graphs extends this construction - to graphs over $q=p^n$ vertices, by using the finite field $F_q$ instead of $\\mathbb{Z}/p\\mathbb{Z}$. + to graphs over $q=p^n$ vertices, by using the finite field $F_q$ instead of $\mathbb{Z}/p\mathbb{Z}$. This construction requires to compute squares in general finite fields and is not what is implemented here (i.e `paley_graph(25)` does not return the true Paley graph associated with $5^2$). -- cgit v1.2.1