summaryrefslogtreecommitdiff
path: root/networkx/algorithms/regular.py
Commit message (Collapse)AuthorAgeFilesLines
* Update developer requirements (#6429)Jarrod Millman2023-02-141-2/+2
| | | | | * Update developer requirements * Run linter
* plugin based backend infrastructure to use multiple computation backends (#6000)Mridul Seth2022-11-081-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Wrappers classes to dispatch to a backend * Rework the backend dispatching - Use __networkx_plugin__=name to find graph-like objects instead of subclassing - Add PluginInfo to smooth over differences in importlib.metadata across python versions - Add dispatch behavior override via environment variable to aid in testing plugins * Dispatch more algorithms and improve auto-test capabilities * Allow dispatcher decorator without a name - Name is taken from the decorated function - Raise error if backend doesn't implement a decorated function which is called - Check for duplicate names for dispatching algorithms * Make sphinx pick up backend docs * make black happy * Rename decorator to _dispatch as it's experimental * A few more dispatched functions * Make convert to and from methods for auto-testing - Rename `convert` to `convert_from_nx` - Add `convert_to_nx` function These will allow backends to return native objects when dispatching, but provide a mechanism to convert the result to the type expected by NetworkX tests for the auto-test plugin mechanism. * More dispatching * Include name with `convert_**_nx` methods * Remove known plugin names This check is not needed, as any plugin can register itself in the entry points section. The dispatching and auto-testing explicitly specify the plugin to use, so there is no need to hardcode the options. These were originally included for security, but any malicious actor would simply use one of the valid names, so having a hardcoded list does not actually provide any meaningful security. * Add `dispatchname` to dispatchable functions Co-authored-by: Jim Kitchen <jim22k@gmail.com> Co-authored-by: Erik Welch <erik.n.welch@gmail.com>
* added examples to regular.py (#5642)Lukong1232022-07-051-0/+19
| | | | | | | | | | | | | * added example on is_regular * added example on is_k_regular * added example_k_factor * added missing parentheses Co-authored-by: Mridul Seth <mail@mriduls.com> Co-authored-by: Mridul Seth <mail@mriduls.com>
* Use isort with pre-commit to enforce import guidelines (#5659)Mridul Seth2022-06-021-2/+1
| | | | | * Add isort to pre-commit * Run isort on all python files (except __init__.py ones)
* Fix docstrings and remove unused variables (#4501)Andrea Tomassilli2021-01-091-1/+1
| | | | Co-authored-by: Dan Schult <dschult@colgate.edu> Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Format w/ blackJarrod Millman2020-07-101-20/+17
|
* Add algorithms for regular graphs (#3925)Camden Cheek2020-06-251-0/+194
* Adds the functions is_regular, is_k_regular, and k_factor. The functions `is_regular` and `is_k_regular` are fairly self-explanatory. The `k_factor` function implements an algorithm for computing the k-factor of a graph. The algorithm is described in "An algorithm for computing simple k-factors" (Meijer, H., Núñez-Rodríguez, Y., & Rappaport, D. 2009). * Remove numpy dependency * Implement PR feedback * Add documentation and export for algorithms.regular