summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fix docstring typodoc-typoJarrod Millman2021-06-041-2/+2
|
* Bump release versionJarrod Millman2021-05-311-1/+1
|
* Designate 2.6rc1 releasenetworkx-2.6rc1Jarrod Millman2021-05-311-1/+1
|
* Remove "networkx" from top-level networkx namespace (#4840)Ross Barnowski2021-05-315-43/+48
| | | | | | | | | | | | | * Add a test to catch importing aliases. * Add test for another bad import pattern. * Fix one bad import pattern. Adds __all__ to some modules where it was missing. * use `from ... import` in all __init__ imports Co-authored-by: Dan Schult <dschult@colgate.edu>
* Default to NumPy for simrank_similarity (#4841)Jarrod Millman2021-05-304-80/+236
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Default to NumPy for simrank_similarity * fix typo: targete -> target * arg G left out of call to simrank_similarity * Fix * More * Add pre/post processing of nodes in simrank_similarity Added test for noninteger nodes Added and updted examples in docstrings cleaned up some tests * parametrize tests so new _python version tested * Move similarity_numpy code to private function so deprecating requires very little code change. * implement changes from the discussion Move warning so doesn't show unless _numpy() version called Add test of difference between python and numpy version Add exception when methods don't converge Add tests of convergence exception Remove _is_close function * increase maxiterations and error handling including for isolated nodes * black Co-authored-by: Dan Schult <dschult@colgate.edu>
* Use scipy to compute eigenvalues (#4847)Jarrod Millman2021-05-304-10/+58
| | | | | | | | | | | | | * Use scipy to compute eigenvalues * Compute svd instead * Clean up * Document changes * Update test_hits to look at convergence failing Co-authored-by: Dan Schult <dschult@colgate.edu>
* Add dtype argument to adjacency_matrix (#4850)Jarrod Millman2021-05-276-15/+41
| | | and deprecate adj_matrix
* add special processing of `multigraph_input` upon graph init (#4823)Dan Schult2021-05-276-16/+190
| | | | | | | | | | | | | | | | | | * add special processing of `multigraph_input` upon graph init Fixes: #4720 Adding a keyword argument `multigraph_input=True` to a graph construction call should treat any incoming input data for the graph as a dict-of-dict-of-dict multigraph data structure. Previously the multigraph_input argument would be added to the graph attribute dict and ignored when processing the input data. * Change default and add tests * make default try mgi=True, and if fails try mgi=False * copy parameter docstring to main class
* Remove unused `normalized` parameter from ↵Dan Schult2021-05-273-15/+27
| | | | | | | | | communicability_betweenness_centrality (#4843) * Remove unued `normalized` parameter from communicability_betweenness_centrality * dd API change to release_dev.rst * add tests for small graphs
* Add info about testing and examples (#4582)Jarrod Millman2021-05-262-0/+45
| | | | | | | | | | | | | | | | | * Add info about testing and examples * Update CONTRIBUTING.rst Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Document testing * Incorporate feedback * Cleanup * rst nit. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Fix bad import pattern (#4839)Ross Barnowski2021-05-268-0/+20
| | | | | | | | | | | * Add a test to catch importing aliases. * Add test for another bad import pattern. * Fix one bad import pattern. Adds __all__ to some modules where it was missing. * RM networkx namespace test.
* Draft 2.6 release notes (#4828)Ross Barnowski2021-05-262-5/+117
| | | | | | | | | | | | | | | | | | | | * external -> internal gallery link. * Add section on NXEPs. * Go through PRs and add to release notes. * go through release_dev -- add some "improvements" * Apply suggestions. Co-Authored-By: Jarrod Millman <jarrod.millman@gmail.com> * Apply suggestions. Co-Authored-By: Jarrod Millman <jarrod.millman@gmail.com> Co-authored-by: Dan Schult <dschult@colgate.edu> Co-authored-by: Jarrod Millman <jarrod.millman@gmail.com>
* Fix edge drawing performance regression (#4825)Ross Barnowski2021-05-262-127/+219
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add back line coll. style drawing and encapsulate. Adds back drawing edges via LineCollection that was removed in #4360. Encapsulates the two different drawing methods in internal functions; one for FancyArrowPatches and one for LineCollection. * WIP: add new kwarg, mv up fn defns. * apply axis scaling to both edge drawing fns. * use fancy arrow patch for digraphs + arrow=True (default). * draw selfloops even for undirected graphs. * TST: Add test for desired behavior of arrows kwarg. Tests 3-way switching between default behavior, forcing fancy arrow patches, and forcing line collections. * Implement 3-way behavior switch w/ arrows kwarg. Co-Authored-By: Dan Schult <dschult@colgate.edu> * Update docstring and add example. * Fix docstring Co-authored-by: Dan Schult <dschult@colgate.edu> Co-authored-by: Dan Schult <dschult@colgate.edu>
* Refactor testing utilities (#4829)Jarrod Millman2021-05-2653-715/+804
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Refactor testing utilities Change `assert_edges_equal`, `assert_graphs_equal`, and `assert_nodes_equal` to be more pytest-idiomatic. For example, `assert_edges_equal` becomes the Boolean function `edges_equal` and then the assert is done the testing file (i.e., `assert edges_equal(edges1, edges2)`). This also makes these utility functions useful in nontesting situations where you want to compare edges, but not raise an exception based on the result. * Move testing utility functions * Use new testing utilities * Deprecate assert_*_equal testing utilities * Document node, edge, and graph equality helper functions * text nits. * Update networkx/tests/test_convert_pandas.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update networkx/readwrite/tests/test_sparse6.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update networkx/readwrite/tests/test_graph6.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update networkx/generators/tests/test_classic.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update networkx/algorithms/tree/tests/test_operations.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update networkx/algorithms/tree/tests/test_coding.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update networkx/algorithms/tests/test_dag.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update networkx/algorithms/minors/tests/test_contraction.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * add short equality description to docstring * Suppress known warnings Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> Co-authored-by: Dan Schult <dschult@colgate.edu>
* Fix a few broken links in the html docs (#4572)Ross Barnowski2021-05-265-20/+19
| | | | | | | | | | | * Fix 3 broken refs in nxep2. * Fix see also link to average_neighbor_degree. * rm ref to neighbor_connectivity. * Fix links to bipartite sets and is_bipartite from centrality. * Fix links to square_clustering.
* Deprecate run (#4833)Jarrod Millman2021-05-245-34/+13
| | | Use pytest directly instead.
* Limit number of threads used by OMP in circleci. (#4830)Ross Barnowski2021-05-241-0/+2
|
* DOC: Clarify behaviour of k_crust(G, k) (#4831)Bharat Raghunathan2021-05-231-1/+2
|
* Use pytest.approx (#4827)Jarrod Millman2021-05-2138-374/+364
| | | | | * Use pytest.approx * Deprecate almost_equal
* Remove pyyaml dependency via module getattr (#4802)Ross Barnowski2021-05-209-153/+167
| | | | | | | | | | | | | | | | | | | | | | | | | * WIP: adding getattr to nx_yaml module. * WIP: Tests that informative exceptions raised. * Add tests for informative messages. * Add getattrs to higher-up pkgs. * Remove test_yaml.py * Remove pyyaml from requirements. * Update examples in warning messages. Ensure they are correct, runnable examples. * Add security warning and removal time to message. * Cp __getattr__ to other mods/pkgs. * Update deprecation notes w/ getattrs. * Remove yaml section from docs.
* Fixes read/write_gml with nan/inf attributes (#4497)happy2021-05-202-7/+124
| | | | | | | | | | | | | * handle nan/inf for gml files * handle nan/inf for gml files * ran black * Better fix for nan/inf. * add tests for special floats in gml.py Co-authored-by: Dan Schult <dschult@colgate.edu>
* Deprecate preserve_random_state (#4826)Jarrod Millman2021-05-204-0/+10
|
* Fix to_undirected doc typo (#4821)Justin Cai2021-05-202-2/+2
|
* switch alias direction of spring_layout and fruchterman_reingold_layout (#4820)Dan Schult2021-05-191-3/+4
|
* Link to guides (#4818)Jarrod Millman2021-05-194-6/+7
| | | | | | | * Link to guides * Shorten names * Simplify menu
* Add `initial_graph` parameter to simple and dual Barábasi-Albert random ↵Ludovic Stephan2021-05-193-145/+167
| | | | | | | | | graphs (#4659) Adds an initial_graph parameter to allow users to specify a base graph to the BA and dual BA genertors. Co-authored-by: Ludovic Stephan <ludovic.stephan@ens.fr> Co-authored-by: Dan Schult <dschult@colgate.edu>
* Add topological_generations function (#4757)as13712021-05-193-30/+119
| | | | | | | Adds a topological_generations function and refactor topological_sort to yield from topological_generations. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> Co-authored-by: Dan Schult <dschult@colgate.edu>
* Fix Sphinx errors (#4817)Jarrod Millman2021-05-193-3/+5
|
* Update requirements (#4625)Jarrod Millman2021-05-193-6/+6
|
* restructured networksimplex.py and added test_networksimplex.py (#4685)Harshal Dupare2021-05-192-305/+768
| | | | | | | | | | | | | | | | | | | | | | * restructured networksimplex.py and added test_networksimplex.py * formatting changed * formatting changed * formatting changed * removed extra underscore * added fixture in test_networksimplex.py * formatting changed * initilized -> initialized. * fix typo in comment Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> Co-authored-by: Dan Schult <dschult@colgate.edu>
* Make nx.hits a wrapper around different implementations, use scipy one by ↵Mridul Seth2021-05-193-31/+66
| | | | | | | | | default (#4812) * implement nstart for scipy version of hits * deprecate python impl and use scipy one by default Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Remove dictionary from signature of tree_graph and tree_data (#4786)Ross Barnowski2021-05-186-158/+253
| | | | | | | | | | | | | | | * Deprecate attrs dict in json_graph.tree fns. Replace attrs dict in signature with explicit kwargs and add deprecation warning. Adds tests that the behavior isn't changed and that warnings are raised when expected. * Add deprecations to list and ignore warnings in conftest. * Modify cytoscape functions attrs deprecation. * Cleanup cytoscape test suite.
* Use `callable()` to check if the object is calllable (#1) (#4678)Harsh Mishra2021-05-182-3/+3
| | | | | Co-authored-by: erbeusgriffincasper@gmail.com Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
* Pin upper bound on decorator for 2.6 release. (#4815)Ross Barnowski2021-05-181-1/+1
|
* Restructure documentation (#4744)Jarrod Millman2021-05-1830-279/+476
| | | | | | | | | | | | | * Move credit to dev guide * Simplify menu * Reclaim empty sidebar space * Simplify release log * Cleanup bibliography * Clean up
* Update black (#4814)Jarrod Millman2021-05-1820-37/+37
|
* adds implementation of SNAP summarization algorithm (#4463)Douglas Fenstermacher2021-05-174-12/+893
| | | | | | | | | | | * adds implementation of SNAP summarization algorithm Thanks to dschult and rossbar for many much-needed recommendations for refining and optimizing the implementation * Seed layouts for snap gallery examples. Make sure the layouts are reproducible. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Add approximation algorithms for traveling salesman problem (#4607)Dan Schult2021-05-1611-99/+1442
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add greedy algorithm for solving TSP Many problems of Combinational Optimization can be represented as graphs. These problems have enormous significance in many aspects of science, but there are not any algorithms to solve some of them in polynomial time. However many, heuristic and metaheuristic algorithms have been published over the past years in order to solve / approximate the solutions to these problems. The purpose of this commit is to add implementation of such algorithms for solve one of the most famous problems of Combinational Optimizations, Travelling Salesman Problem (TSP). A greedy algorithm has been implemented at the moment for this reason. "applications" package has been created which include modules that represent a problem. Each module contains several algorithms for solving the specific problem. At this commit, tsp.py module is added which contains greedy_tsp() function; a implementation of a greedy algorithm. * Fix example error * Trivial changes List of changes: Removal of unnesecary _is_weighted() function Improvements on documentation * Add applications package to setup.py file * Change output of greedy algorithm Algorithm's output is a list of nodes now * Add simulated annealing algorithm Add a metaheuristic local search algorithm for solving TSP * Minor changes * Fix example doc errors * Compatible with python 3 * Move tsp module to algorithms package * Code improvements * Handle small graphs and fix doc examples * Documentation changes and rename variables * Adds Threshold Accepting algorithm for TSP * Implemented maximal matching of minimal weight and created test suite. * Removed useless print * Implemented Christofides. * Coding was missing * Add more general traveling_salesman_problem using christofides Also reconfigure import structure and remove min_weight_matching from module since it is now in matching.py * Add new functions to the docs and minor typos * pep8 fixes * fix pep8 and change .gitignore * Add tests of the approximation namespace update docs in approximation/__init__.py * Fix is_matching to check if edges in G. Other tweaks: doc changes and put not_implemented_for on find_matching functions * Improve is_matching selfloop handling and expand tests * Move tsp to approximation directory. Apply black. * Move tsp tests to approximation tests folder * Attempt to bring tsp up to current code. * commit pep8 that my black didnt change, but pep8speaks did find. ?? * tweak a few things and run black * combine #4083 and #3585 into traveling_salesman.py * Match chistofides output to other tsp functions and adjust calling syntax of tests tweak docs tweak see also section * Put big-O complexity in in-line math env. Prevents sphinx from trying to do variable substitution between pipes. * Minor touchups to christofides docstring. * RST touchups to tsp module docstring. * Rm extra string from tsp module. * Docstring touchups for traveling_salesman_problem. * rst fixups for greedy_tsp docstring. * rst formatting for simulated annealing docstring. * More math in-lining for simulated annealing docstring. * rst and minor grammatical fixes to TA docstring. * Fix path-finding and test all methods for tsp function * the refactoring was incomplete. Now maybe is - Add tests of TSP with all methods. - Refactor tests to match simulated_annealing tests and threshold tests. - Unify treatment of weight so unweighted edges use default weight 1. weight now defaults to "weight" with a default value of 1. - Rename tolerance to max_iterations (tolerance is used for error bound) - Rename iterations to N_inner (each iteration takes this many inner loops) - Introduce idioms like `pairwise` and `cycle.copy()` (over cycle[:]) - Allow passthrough of method kwargs for traveling_salesman_problem Still need to: - add test of case where path is more than one edge less that cycle (incomplete_graph) - require cycle input (maybe make default list(G)??) - consider the complexity claims in the doc_strings * More api changes to TSP functions - `chritofides` now allows (and ignores) selfloops - `move` can be a function as well as "1-1" and "1-0" - `method` for traveling_salesman_problem must have 2 arguments instead of passing kwargs. User must "curry" to set parameters - changed doc_string typos in matching.py * Add test to check that cycle=False can remove many edges * Change init_cycle api to require input from user The idea is to make the user specify the initial cycle to start from rather than relying on the programmers default of a greedy algorithm. To easy usage, I check for a string "greedy" as a shortcut. * Update docs with more correct complexity info. * Check for complete graph now more efficient and selfloops ignored * merge is_matching changes Co-authored-by: Thodoris Sotiropoulos <theosotr@windowslive.com> Co-authored-by: Luca Cappelletti <cappelletti.luca94@gmail.com> Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Improve documentation look (#4801)Jarrod Millman2021-05-155-19/+49
|
* fix urllib import (#4793)Xiangyu Xu2021-05-142-3/+3
| | | | | * fix urllib import * update urllib import
* make plots less dense, enable plotting for igraph (#4791)Mridul Seth2021-05-142-12/+19
| | | Make igraph plotting example render in gallery
* Remove mayavi and cartopy dependencies (#4800)Jarrod Millman2021-05-136-41/+0
|
* Fix sphinx warnings during doc build. (#4795)Ross Barnowski2021-05-123-5/+6
|
* Update documentation dependencies (#4794)Jarrod Millman2021-05-122-3/+6
| | | | | * Update documentation dependencies * Speed up theme
* Add auto-margin scaling in draw_networkx_nodes function (fix for issue 3443) ↵Eric Sims2021-05-121-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#4769) * [auto-margin scaling in draw_networkx_nodes function] * added optional margins arg to draw_networkx_nodes * updated draw_networkx_nodes margins docstring * Removed unnecessary import in draw_networkx_nodes * Update networkx/drawing/nx_pylab.py Co-authored-by: Dan Schult <dschult@colgate.edu> * Improve draw_networkx_nodes margins docstring Co-authored-by: Dan Schult <dschult@colgate.edu> * unpacking logic for *margins * quick fix on margins logic * Update draw_networkx_nodes margins docstring Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * draw_networkx_nodes docstring update * draw_networkx_nodes docstring update * Update draw_networkx_nodes margins control flow Co-authored-by: Dan Schult <dschult@colgate.edu> Co-authored-by: Dan Schult <dschult@colgate.edu> Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* imread(url) is deprecated, use pillow + urllib to load image from URL (#4790)Mridul Seth2021-05-111-2/+5
|
* Get rid of invalid escape sequences. (#4789)Ross Barnowski2021-05-114-6/+6
| | | | | | | | When running the test suite, there are new deprecation warnings about invalid escape sequences. This is from LaTeX math in some docstrings, which often feature backslashes. The simplest way to get rid of these warnings is to convert the docstrings into raw strings.
* Gallery Example: Drawing custom node icons on network using MPL (#4633)Alex Walker2021-05-111-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Added images to the generate graph * Cleaned up comments * Added comment for node addition * Ross's suggestion Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Ross's suggestion Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Ross's suggestion Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Ross's suggestion Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * revised code * added comment * Update examples/drawing/plot_mpl_annotations.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Update examples/drawing/plot_mpl_annotations.py Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> * Rename plot_mpl_annotations.py to plot_custom_node_icons.py Co-authored-by: Alex <a.c.walker@student.tudelft.nl> Co-authored-by: Sharwin Bobde <31354242+sharwinbobde@users.noreply.github.com> Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> Co-authored-by: Sharwin Bobde <bsharwin@gmail.com>
* Updated decorator requirement for #4718 (#4773)Taxo Rubio2021-05-041-1/+1
|
* Improve reproducibilty of geometric graphs (#4768)Fabio Mazza2021-05-041-1/+1
|