Skip to content

Commit

Permalink
Update lcf_graph docstring.
Browse files Browse the repository at this point in the history
Use numpydoc docstring standard and fixup formatting/examples.
  • Loading branch information
rossbar committed Jan 30, 2024
1 parent 30ac795 commit 97ed184
Showing 1 changed file with 32 additions and 17 deletions.
49 changes: 32 additions & 17 deletions networkx/generators/small.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,36 +64,51 @@ def LCF_graph(n, shift_list, repeats, create_using=None):
"""
Return the cubic graph specified in LCF notation.
LCF notation (LCF=Lederberg-Coxeter-Fruchte) is a compressed
LCF (Lederberg-Coxeter-Fruchte) notation[1]_ is a compressed
notation used in the generation of various cubic Hamiltonian
graphs of high symmetry. See, for example, dodecahedral_graph,
desargues_graph, heawood_graph and pappus_graph below.
graphs of high symmetry. See, for example, `dodecahedral_graph`,
`desargues_graph`, `heawood_graph` and `pappus_graph`.
n (number of nodes)
The starting graph is the n-cycle with nodes 0,...,n-1.
(The null graph is returned if n < 0.)
For each node ``n_i``, cycling through the n-cycle a total of ``len(shift_list) * repeats``
with shift cycling through `shift_list` `repeat` s times connects ``n_i``
with ``n_i + shift mod n``.
shift_list = [s1,s2,..,sk], a list of integer shifts mod n,
Parameters
----------
n : int
The starting graph is the `n`-cycle with nodes ``0, ..., n-1``.
The null graph is returned if `n` < 1.
repeats
integer specifying the number of times that shifts in shift_list
are successively applied to each v_current in the n-cycle
to generate an edge between v_current and v_current+shift mod n.
shift_list : list
A list of integer shifts mod `n`, ``[s1, s2, .., sk]``
For v1 cycling through the n-cycle a total of k*repeats
with shift cycling through shiftlist repeats times connect
v1 with v1+shift mod n
repeats : int
Integer specifying the number of times that shifts in `shift_list`
are successively applied to each current node in the n-cycle
to generate an edge between ``n_current`` and ``n_current + shift mod n``.
Returns
-------
G : Graph
A graph instance created from the specified LCF notation.
Examples
--------
The utility graph $K_{3,3}$
>>> G = nx.LCF_graph(6, [3, -3], 3)
>>> G.edges()
EdgeView([(0, 1), (0, 5), (0, 3), (1, 2), (1, 4), (2, 3), (2, 5), (3, 4), (4, 5)])
The Heawood graph
The Heawood graph:
>>> G = nx.LCF_graph(14, [5, -5], 7)
>>> nx.is_isomorphic(G, nx.heawood_graph())
True
See http://mathworld.wolfram.com/LCFNotation.html for a description
and references.
References
----------
.. [1] https://en.wikipedia.org/wiki/LCF_notation
"""
if n <= 0:
Expand Down

0 comments on commit 97ed184

Please sign in to comment.