summaryrefslogtreecommitdiff
path: root/networkx/algorithms
Commit message (Collapse)AuthorAgeFilesLines
* Handle weights as `distance=` in testing dispatch (#6671)Erik Welch2023-05-131-1/+2
| | | | | | | | * Handle weights as `distance=` in testing dispatch * fix `test_intersection` This change was suggested here: https://github.com/python-graphblas/graphblas-algorithms/pull/62#issuecomment-1531810715
* Improve test coverage for mst.py (#6540)Alimi Qudirah2023-05-131-0/+37
| | | | | * fixes for 6539 * add more tests to test_mst.py
* codespell: pre-commit, config, typos fixed (#6662)Yaroslav Halchenko2023-05-032-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | * One ambigous typo * one more ambigous typo * [DATALAD RUNCMD] run codespell throughout === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ For this to work -- it would require configuration files which were abandoned. See https://github.com/networkx/networkx/pull/6662 for more discussion etc. * Manual reversion of perform... "fix"
* added tests to euler.py (#6608)Alimi Qudirah2023-05-031-0/+12
| | | | | | | | | | | | | | * fixes-for-6607 * Update networkx/algorithms/tests/test_euler.py Co-authored-by: Mridul Seth <mail@mriduls.com> * Update euler test --------- Co-authored-by: Mridul Seth <mail@mriduls.com> Co-authored-by: Mridul Seth <git@mriduls.com>
* Remove `topo_order` kwarg from `is_semiconnected` without deprecation. (#6651)Ross Barnowski2023-05-031-9/+14
| | | | | | | | | | | * Remove topo_order kwarg without deprecation. * Add release note about semiconnected removing the topo_order kwarg. * Add to doc_string the method used to find semiconnected --------- Co-authored-by: Dan Schult <dschult@colgate.edu>
* Improve test coverage for reaching.py (#6678)Vanshika Mishra2023-05-021-0/+8
|
* Improve Test Coverage for current_flow_closeness.py (#6677)Vanshika Mishra2023-05-021-0/+6
| | | Improve_test_coverage_cfc.py
* Improve test coverage for neighbor_degree.py (#6589)Alimi Qudirah2023-05-021-0/+4
| | | added tests for neighbor_degree.py
* Added tests to test_correlation.py (#6590)Alimi Qudirah2023-05-021-0/+15
| | | | | * added tests to test_correlation.py * bugfix-for-6588
* Adding is_tounament to main namespace (#6498)Alimi Qudirah2023-05-021-0/+1
| | | | | * adding is_tounament to main namespace * bugfix for 5542
* Rm unreachable code for validating input (#6675)Ross Barnowski2023-05-011-6/+0
| | | Rm un-hittable validation lines.
* MAINT: minor coverage cleanup. (#6674)Ross Barnowski2023-05-011-3/+0
|
* Allow multiple graphs for `@nx._dispatch` (#6628)Jim Kitchen2023-04-253-3/+29
| | | | | | | | | | | | | * Allow multiple graphs for nx._dispatch A new `graphs` keyword is added. For the case of two graphs named `G` and `H` as the first to arguments in `foo`, the new spelling is @nx._dispatch(graphs="G,H") def foo(G, H, other_arg, **kwargs): ... * Use better default "G" for graphs kwarg * fix
* Fix output of is_chordal for empty graphs (#6563)Navya Agarwal2023-04-252-4/+10
| | | | | * Fix for is_chordal for empty graphs * Handle self loops case
* Added docstrings examples for clique.py (#6576)Alimi Qudirah2023-04-251-0/+24
| | | | | | | | | | | | | | | | | | | | | | | * added docstrings examples for clique.py * Update networkx/algorithms/approximation/clique.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update networkx/algorithms/approximation/clique.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * adding corrections * adding corrections * adding corrections to examples * adding corrections --------- Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Make cycle_basis() deterministic (#6654)Efrem Braun2023-04-212-3/+15
| | | | | | Replace sets with dict keys to make cycle_basis deterministic with respect to node ordering. Co-authored-by: Dan Schult <dschult@colgate.edu>
* Use the correct namespace for girvan_newman examples (#6643)Mridul Seth2023-04-161-6/+6
|
* Fix links in eigenvector.py and katz_centrality.py (#6640)Vanshika Mishra2023-04-152-8/+8
| | | Fix links in see also section of docs
* Add examples to bipartite centrality.py (#6613)Navya Agarwal2023-04-111-0/+21
| | | | | | | | | * Add examples to bipartite centrality.py * Import bipartite module * Use lazy loading for bipartite * Minor Edit
* Fix links in laplacian_centrality and laplacian_matrix (#6623)Navya Agarwal2023-04-061-2/+2
| | | Fix links in See Also section
* Fix typos (#6620)Harri Nieminen2023-04-0415-21/+21
|
* Fix module docstring format for ismags reference article. (#6611)Ross Barnowski2023-04-031-14/+13
| | | | | | | Improperly formatted Notes/References sections was causing a sphinx parsing error which led to a very poorly formatted html page. Fixing the numpydoc formatting for the module docstring + minor munging of the heading levels was sufficient to fix this.
* Minor docs/test maintenance (#6614)Ross Barnowski2023-04-031-2/+2
| | | | | | | * doc: fix docstring heading, eliminate sphinx error. * doc: change extension of included file to prevent duplicate labels. * tst: add warnings filter for deprecated forest_str.
* Fixed method description in ismags.py (#6600)Navya Agarwal2023-04-021-2/+2
| | | | | * Fix docstr of partition_to_color * Minor edit
* corrections to docstring of `weisfeiler_lehman_subgraph_hashes` (#6598)Aaron Z2023-04-011-7/+12
| | | | | | | | | | | * corrections to docstring of weisfeiler_lehman_subgraph_hashes * Update networkx/algorithms/graph_hashing.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> --------- Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Added Docstring Example for Bidirectional Shortest Path (#6570)Vanshika Mishra2023-03-291-0/+7
| | | | | | | | | * Docstring Example for Bidirectional Shortest Path * output correction * graph simplified * retrigger checks
* Fixed return type inconsistencies in weighted.py (#6568)Navya Agarwal2023-03-281-7/+9
| | | Fixed return type inconsistencies
* Test dispatching via nx-loopback backend (#6536)Jim Kitchen2023-03-283-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add tests for nx._dispatch decorator The dispatch functionality is used to delegate graph computations to a different backend. Because those backends are not part of NetworkX, testing the dispatching feature was not originally added, relying instead on the other backends (e.g. graphblas-algorithms) to verify the dispatch functionality is working. This change creates a "loopback" backend where NetworkX dispatches to itself for the sole purpose of exercising the dispatching machinery. In one incarnation, various tests are augmented to use the LoopbackGraph family and force loopback dispatching to occur as normal usage would. A second incarnation forces *all* tests to run in dispatch mode but use of a different _dispatch decorator. This mode is triggered for all of pytest, so it must be tested by the CI system specifically. * Update CI to hopefully run dispatching auto tests * Formatting * More formatting fixes * Better comments explaining dispatching tests
* add simple cycle enumerator for undirected class (#6461)Kelly Boothby2023-03-292-88/+1131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add simple cycle enumerator for undirected class * Implemented Gupta & Suzumura and refactored Johnson in a common form and unified their call-site. Now, users can enumerate simple cycles of directed or undireced graphs, with bounded or unbounded length, all from the same `simple_cycles` function. I abandoned the stretch goal of enumerating chordless cycles, as they are not gracefully handled by the algorithms of Johnson nor Gupta & Suzumura. * updated tests for simple_cycles to include undirected graphs * * fixed documentation issues, elaborated on algorithm details * restricted to nontrivial components * removed specialized DFS to pick edges from undirected components lemma: if G is a biconnected graph with at least 3 nodes and e is an edge in G, then e belongs to a cycle * added tests for undirected and bounded cases for simple_cycles * added handling for digons in multigraphs * * Improved support for multigraphs * Split chordless_cycles out from simple_cycles because the case analysis got so tricky * Added enhanced cycle-testing framework to tests for simple_cycles * Added tests for multigraphs * Needs more documentation * * Documented simple_cycles * Caught incorrectly-handled case of parallel self-loops * removed chordless option from simple_cycles * typos/raises/leftovers in docs and error/corner tests * add a quick example to chordless_cycles * Add chordless_cycles to docs --------- Co-authored-by: Dan Schult <dschult@colgate.edu> Co-authored-by: Mridul Seth <git@mriduls.com>
* Deprecate shortest_path functions to have consistent return values in v3.3 ↵Dan Schult2023-03-282-0/+11
| | | | | | | (#6567) * Deprecate single_target..._length to channge to return a dict in v3.3 * deprecate shortest_path in case of all_pairs
* Optimize _single_shortest_path_length function (#6299)Tortar2023-03-281-23/+22
| | | | | * Optimize _single_shortest_path_length function * Update unweighted.py
* Fixed return type inconsistencies in shortest path methods documentation (#6528)Navya Agarwal2023-03-281-3/+3
| | | | | * Fixed return type inconsistencies * Fix doc error in all_pairs_shortest_path
* Improve test coverage for redundancy.py (#6551)Navya Agarwal2023-03-281-0/+6
| | | Test if condition in redundancy.py
* improve test coverage for branchings.py (#6523)Alimi Qudirah2023-03-231-0/+53
| | | | | | | | | | | | | | | * fixes for 6520 * Update networkx/algorithms/tree/tests/test_branchings.py Co-authored-by: Dan Schult <dschult@colgate.edu> * Update networkx/algorithms/tree/tests/test_branchings.py Co-authored-by: Dan Schult <dschult@colgate.edu> --------- Co-authored-by: Dan Schult <dschult@colgate.edu>
* Add docstring examples to boundary.py (#6487)Navya Agarwal2023-03-231-0/+28
| | | | | * Add docstring examples to boundary.py * Change example to wheel_graph
* Add example script for mst (#6525)Purvi Chaurasia2023-03-231-0/+1
| | | | | | | | | | | | | | | | | | | * Fix negative edge cycle function raising exception for empty graph and added relevant test function * Unresolved change * Added example script for generating mst * unresolved changes * update plot_mst.py * Fixed typo Co-authored-by: Dan Schult <dschult@colgate.edu> --------- Co-authored-by: Dan Schult <dschult@colgate.edu>
* Add docstring examples to dag.py (#6491)Navya Agarwal2023-03-231-0/+7
| | | | | * Docstr examples for compute-v-structures * Removed unnecessary example
* Update pre-commit (#6545)Jarrod Millman2023-03-2310-20/+20
|
* Fixed bug k_truss doesn't raise exception for self loops (#6521)Purvi Chaurasia2023-03-211-2/+9
| | | | | | | * Fix negative edge cycle function raising exception for empty graph and added relevant test function * Fixed k_truss doesn't raise exception for self loops * conflicts resolved
* Updating removing explicit import for communities (#6459)Lukong Anne2023-03-1712-98/+78
| | | | | | | Modify user-facing code to use the `community` package from the top-level namespace. Co-authored-by: Dan Schult <dschult@colgate.edu> Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Improve test coverage for mst.py and bug fix in prim_mst_edges() (#6486)Navya Agarwal2023-03-172-0/+59
| | | | | * Improve test coverage for Kruskal & Prim * Bug fix in prim_mst_edges()
* Improve test coverage for edgelist.py (#6507)Navya Agarwal2023-03-171-0/+37
| | | | | * Add tests for parse_edgelist * Fix to ensure that right TypeError is hit
* Add docstring example to weighted.py (#6497)Navya Agarwal2023-03-141-0/+9
| | | Docstr example for dijkstra_path
* Improve test coverage for astar.py (#6504)Navya Agarwal2023-03-141-0/+14
| | | Improve test coverage for Astar
* Dispatch more BFS-based algorithms (#6467)Erik Welch2023-03-115-0/+9
|
* Fix negative edge cycle function raising exception for empty graph (#6473)Purvi Chaurasia2023-03-113-1/+7
| | | | * Fix negative edge cycle function raising exception for empty graph and added relevant test function * Comment out capacity_scaling test
* Clean up similarity.py and use dataclasses for storing state (#5831)Mridul Seth2023-02-281-40/+28
| | | | | * Clean up similarity.py and use dataclasses for storing state * use nonlocal to stop using an object to store maxcost value
* Start using ruff for pyupgrade and isort (#6441)Mridul Seth2023-02-251-1/+3
|
* Lint using Ruff (#6371)danieleades2023-02-1966-280/+268
| | | | | | | | | | | | | | | * lint and fix using ruff * add flake8-pie lints * remove useless import alias * bump version * bump deps --------- Co-authored-by: daniel.eades <daniel.eades@hotmail.com>
* Update developer requirements (#6429)Jarrod Millman2023-02-1446-89/+57
| | | | | * Update developer requirements * Run linter