summaryrefslogtreecommitdiff
path: root/networkx
diff options
context:
space:
mode:
authorPaula PĂ©rez Bianchi <44149844+paulitapb@users.noreply.github.com>2023-03-21 05:48:16 -0300
committerGitHub <noreply@github.com>2023-03-21 14:18:16 +0530
commit0a114ae30bece92b80880d99fe156ce418796d5d (patch)
treeda2e521e3afa3a84fcc9ee466ac3dabc7da0713f /networkx
parent02f23bc5a76544e3f0111aab75b73831cf59687a (diff)
downloadnetworkx-0a114ae30bece92b80880d99fe156ce418796d5d.tar.gz
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 <dschult@colgate.edu> * Update networkx/generators/expanders.py Co-authored-by: Dan Schult <dschult@colgate.edu> * format docstring as raw to use normal latex --------- Co-authored-by: Dan Schult <dschult@colgate.edu>
Diffstat (limited to 'networkx')
-rw-r--r--networkx/generators/expanders.py14
1 files changed, 7 insertions, 7 deletions
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$).