| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
add/remove_edges_from. (#6268)
* doc for add_edges_from
* doc for digraph
* doc for multigraph
* multigraph.add_nodes_from returns keylist
* update docs for graph - edges
* doc update: graph.add_nodes_from
* doc update: graph.remove_nodes_from
* doc update: graph.add_edges_from
* doc update: rewording for graph.add_edges_from
* doc update: graph.add_weighted_edges_from rewording
* doc update: digraph updated as graph
* doc update: digraph minor sync
* doc update: multigraph same as graph
* Update graph.py
* Update digraph.py
* Update multigraph.py
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Use scipy.sparse array datastructure
* Add reminder to rm wrapper when scipy adds creation fns.
* Rm mention of np matrix from code comment.
* Update networkx/algorithms/bipartite/matrix.py
Co-authored-by: Stefan van der Walt <sjvdwalt@gmail.com>
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Co-authored-by: Stefan van der Walt <sjvdwalt@gmail.com>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Automate reset of cache for _adj,_pred,_succ
* Make G._adj a data descriptor that resets G.adj when needed.
* update places in the code where both G._succ and G._adj are changed
This is no longer needed since G._succ and G._adj are synced during __set__
* testing hasattr(G, `_adj`) no longer ensures an instance.
* Make mypy happy
* Switch to hardcode attribute names in the data descriptors
* Improve doc_strings for the data descriptors
|
| |
|
| |
Move factory attributes to the class instead of instance. ?speedup?
|
| |
|
|
|
|
| |
Removes the deprecated OrderedGraph classes.
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Co-authored-by: Dan Schult <dschult@colgate.edu>
|
| |
|
|
|
|
|
|
|
|
| |
* Remove deprecated function nx.info
* remove functions from TOC
* replace print(nx.info(G)) with print(G) in example
Co-authored-by: Dan Schult <dschult@colgate.edu>
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
| |
|
|
|
| |
* Add isort to pre-commit
* Run isort on all python files (except __init__.py ones)
|
| |
|
|
| |
* Make all graph properties cached properties
* one test function is not needed due to test inheritance
|
| | |
|
| |
|
|
|
|
| |
Fix the return type and description for the `degree` method in the
docstrings of all the graph classes.
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix return type in docstring of internal function.
* Rm explicit mention of numpy matrix from class docstrings.
* Fix return type of floyd_warshall_numpy docstring.
* Remove mention of numpy matrix from code comment.
* Fix simrank similarity internal docstring.
* Rm explicit mention of matrix in favor of 2D array.
* Update to_networkx_graph array exception wording.
* Remove extraneous mention of numpy matrix.
* Don't print array in exception message.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Fixed inconsistent documentation for nbunch parameter in DiGraph.edges()
* Resolved Requested Changes
* Revert changes to degree docstrings.
* Update comments in example.
* Apply wording to edges method in all graph classes.
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
| |
|
|
| |
A more descriptive variable name for exceptions. This reduces local var naming conflicts when
\`e\` is used e.g. to represent edges as a loop variable.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* rst double colons for example code
* add nx. prefix to doctest function calls
* Remove one line from 1->2 migration rst file
the line shows code that works for 1.x *and* 2.x.
But it no longer works for all v2.x code. Readers should just use the
next line of code, so no reason to keep this in the file.
* capture output from subplot and rename DiGraph as DG in introduction.rst
* skip running the entire test suite as an example in old_release_log.rst
* doctest of examples
* remove changes to nexp files
|
| |
|
|
|
|
|
| |
* Raise ValueError if None is added as a node.
Removed some tests that checked that errors raised when None was a node.
* update tutorial to make a stronger statement about None
|
| |
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
| |
Co-authored-by: Dan Schult <dschult@colgate.edu>
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
| |
|
|
|
|
|
| |
* Setup for numpydoc.
* Add to doc requirements.
* Replace napoleon with numpydoc in conf.py.
* DOC: Fixups from numpydoc.
|
| |
|
| |
Use `!r` to trigger string repr with auto quote handling
|
| | |
|
| | |
|
| |
|
| |
Refactor exception handling and improve test specificity.
|
| |
|
|
|
|
|
|
|
|
| |
* Modify graph __str__ to return nx.info.
Returns the result of nx.info(self) instead of only the
instance name.
* TST: Modify tests for new str dunder.
* MAINT: move graph summary to __str__ from info
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Format code w/ black
* Format docstrings w/ black
* Manual cleanup
* Tell pytest to ignore planned deprecations
* Don't call plt.show during testing
* Another known deprecation
* DOC: rm duplicate line from docstring example
* Minor cleanup
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* feat: `clear_edges` in `networkx.Graph`
Method to clear all edges in a graph without altering nodes
or graph attributes. Added corresponding test too.
* tests: improve `test_clear` in `TestGraph`
Added a graph attribute before clearing to test its proper deletion.
too.
* tests: add tests for `clear` and `clear_edges` specific to DiGraph
To test that DiGraph-specific edge records are cleared as well.
* fix: specific `clear_edges` for `DiGraph`
So that DiGraph's pred/succ also get cleared.
* Convert docstrings tests and docs reference links to add clear_edges
Co-authored-by: Dan Schult <dschult@colgate.edu>
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
find -name "*py" | xargs grep -n '" % '
find -name "*py" | xargs grep -n '"\.format('
find -name "*py" | xargs grep -n "' %"
find -name "*py" | xargs grep -n 'msg % '
find -name "*py" | xargs grep -n ' %d '
find -name "*py" | xargs grep -n '\.format('
|
| |
|
|
| |
find networkx -name \*.py -exec pyupgrade --py36-plus {} \;
|
| | |
|
| |
|
| |
Fixes #3733
|
| |
|
|
|
|
|
|
|
| |
The copyright and author stuff is not necessary, out-of-date,
and inconsistent. It takes up visual space and is a pain to
police everyone doing the same thing on the top of the module.
Git handles authorship in a comprehensive and authoritative way.
The LICENSE.txt file applies to all project code.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
| |
Some improvements in the docstrings of the three linked methods: order, number_of_nodes, and _len__.
|
| |
|
| |
This closes #3550.
|
| | |
|
| | |
|