| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
* Add test that fails with current default ('None')
* Update default alpha value.
Co-authored-by: Dan Schult <dschult@colgate.edu>
---------
Co-authored-by: Dan Schult <dschult@colgate.edu>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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 graph_str
Formatted
Fix bug in choosing the source
Fix test
* Fixed issue in choosing source verticies for directed graphs
* reasonable working state
* Fixed logic issues
Fix test, cleanup, formatting
more tests, better comments, fix parent labels
fix pypy issue
Fix format
* Fixes based on review
* Cleaned up test names
* Use open_file decor and remove graph_str
* Remove useage of forest_str from doctest
* Fix style
* style
* Update networkx/readwrite/text.py
Co-authored-by: Dan Schult <dschult@colgate.edu>
* Fixed half sentense
* Add max_depth
* moved comment position
* Describe max depth in algo description
* Allow with_labels to be specified as a str
* Update networkx/readwrite/text.py
Co-authored-by: Mridul Seth <mail@mriduls.com>
* Add network text autodoc stub
* Add removal note for forest_str
---------
Co-authored-by: Dan Schult <dschult@colgate.edu>
Co-authored-by: Mridul Seth <mail@mriduls.com>
|
| |
|
|
|
| |
* Fix_Typos
* Commit_Suggestions
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
(#6093)
* Add failing test for empty list corner case.
* Rm test case that rejects empty lists as attributes.
* Beef up test by checking full round-trip.
* Modify gml parsing to handle empty lists.
* Parametrize test: lists and tuples.
|
| |
|
|
|
|
| |
Removes the deprecated OrderedGraph classes.
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Co-authored-by: Dan Schult <dschult@colgate.edu>
|
| |
|
|
|
|
|
|
| |
* Remove pyyaml dependency
* Make mypy happy.
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Co-authored-by: Mridul Seth <seth.mridul@gmail.com>
|
| |
|
|
|
|
|
|
| |
* Remove gdal dependency
* [skip ci] Rm mention of gdal from roadmap.
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Co-authored-by: Mridul Seth <seth.mridul@gmail.com>
|
| | |
|
| |
|
|
|
| |
* Add isort to pre-commit
* Run isort on all python files (except __init__.py ones)
|
| |
|
|
|
|
|
| |
* Don't use graph6 with directed graphs (#5443)
* Parametrize graph6 tests
* Test graph6 on multigraphs
|
| |
|
|
|
|
|
| |
* CI: sync up black dev requirements version with precommit
* Run black
Co-authored-by: Jarrod Millman <jarrod.millman@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add minimal mypy configuration file.
* Add mypy workflow to GH.
* Properly import sentinels from traversal.edgedfs.
* mypy doesn't like variables named \"e\".
* Rm annotations from single function.
* Fix name collisions in test suite.
Make sure all tests have unique names.
* Rm unused random seed in test setup.
* Rm redundant __all__ specification.
* Silence mypy error from sum(). Mypy bug?
* Fix tsp test instantiation nit.
* \"type: ignore\" to suppress conditional fn sigature errors.
* Remaining \"type: ignore\" to appease mypy.
* Configure mypy to ignore inheritance issues.
* Update exclude conf for CI.
- Add yaml
- Reformat regex containing reportviews
* Rm partial annotations from lukes.py.
Fixes mypy errors due to unannotated code.
* Reorg defaultdict to reduce type: ignore cruft.
* Homogenize signatures for fns defined in conditionals.
* err as varname only in exception catching.
* Fix name collision in Bellman-Ford test suite.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Drop Py37
* XML serialization issue
* Use math.comb
Co-authored-by: Simone Gasperini <simone.gasperini2@studio.unibo.it>
* Run pyupgrade --py38-plus
* Run black
* More documentation
* Deprecate euclidean
Co-authored-by: Simone Gasperini <simone.gasperini2@studio.unibo.it>
|
| |
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
| |
* Add tests that fail on uninformative exception.
* Raise informative exception when non-supported type used.
* Add importorskip to new tests.
* Change naming scheme for backward compatibility.
|
| |
|
|
|
|
|
| |
* Add support for comments=None in parse_edgelist.
* Update docstrings.
* if instead of try/except.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
* New Networkx changes
* Stub for Asadpour. Needed to create GSoC PR
* Update to integrate changes from main
* Added function stubs and draft docstrings for the Asadpour algorithm
* Skeleton classes and methods for tree iterators
* Attempting to set up basic tests for MST of a partition
* testing
* I'm not entirly sure how the commit hook works...
* Moved iterators into the correct files to maintain proper codebase visibility
* Including Black reformat
* Revert "Merge branch 'networkx:main' into main"
This reverts commit 0616a2331adfcc02976d305937aa52272ed48266, reversing
changes made to 1ea769371f54c4c6f9a51f860caf4a60aef7d094.
* Trying to merge again
* Attempting to merge (4)
* Now passes all tests except test_namespace_alias in /tests/test_import.py
* Everything should FINALLY pass (I wipped my networkx dir and re-download from upstream)
* reinstall the pre-commit hook
* Grabbing black reformats
* Working on debugging ascent method plus black reformats
* Ascent method terminating, but at non-optimal solution
* minor edits
* Fixed termination condition, still given non-optimal result
* Minor bugfix, still non-optimal result
* Fixed subtle bug in find_epsilon()
* Cleaned code and tried something which didn't work
* Modified the ArborescenceIterator to accept init partition
* Black formats
* Branch and bound returning optimal solution
* Working Ascent method, code needs cleaning
* black formatting changes
* Performance tweaks and testing fractional answers
* Fixed test bug, I hope
* Asadpour output for ascent method
* Fixed numpy imports crashing pypi tests
* Removed branch and bound method. One unit test misbehaving
* Added asymmetric fractional test for the ascent method
* Removed printn statements and tweaked final test to be more asymmetric
* Draft of spanning_tree_distribution
* Black changes
* Changed HK to only report on the support of the answer
* Fixed contraction bug by changing to MultiGraph. Problem with prob > 1
* Black reformats
* Fixed pypi test error
* Further testing of dist fix
* Can sample spanning trees
* Developing test for sampling spanning tree
* Changed sample_spanning_tree test to Chi squared test
* Tweaked signifiance level
* Found true minimum sample size
* fixed typo
* untested implementation of asadpour_tsp
* Fixed issue reading flow_dict
* Fixed runtime errors in asadpour_tsp
* black reformats
* Adding test cases
* documentation update
* Fixed rounding error with tests
* One new test and check
* Documentation update for the iterators
* Attempting to fix class documentation
* Pull out the style changes into a separate branch
* fix mixed history
* more
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: mjschwenne <mjschwenne@gmail.com>
|
| |
|
|
| |
Allow selection of an edge attribute to be the edge id when writing GraphML.
Adds edge_id_from_attribute kwarg.
|
| |
|
|
| |
Decode and preserve GraphML/yEd shape type
and add tests for description and yworks GenericNode
|
| |
|
|
| |
* Add test case for handling default node attributes from graphML
* Add decode conversion to key defaults analogous to decode_data_elements
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
| |
* Use pytest.approx
* Deprecate almost_equal
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
| |
Some tests relied on __eq__ or __ne__ to check whether or
not two Graph instances where the same instance. Use is
and is not instead.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* TST: An approach to parametrizing read_edgelist tests.
Use parametrization to improve code re-use.
Pull tests outside class.
* TST: Add tests for parse_edgelist.
Co-authored-by: Andrew Eckart <andrew.g.eckart@gmail.com>
Co-authored-by: Andrew Eckart <andrew.g.eckart@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add random_ordered_tree and forest_str
* Update networkx/generators/trees.py
I think this makes sense.
Co-authored-by: Dan Schult <dschult@colgate.edu>
* Remove random_ordered_tree
* Fix bug in random_tree when n=1 and create_using is specified
* Add ascii_only mode to forest_str
* fix test
* wip
* Fix comments
* Typo in ascii glyph
* Remove reference to OrderedDiGraph
* Removed imports in doctests
Co-authored-by: Dan Schult <dschult@colgate.edu>
|
| | |
|
| |
|
| |
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
| |
|
| |
Suppress deprecation warnings from numpy 1.20.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#4296)
* move scipy imports into functions
* run black
* Move xml and lxml import inside functions in graphml.py
* Move imports inside functions
* Add tests to graphml.py to appease the codecov CI
* rearrange KDTree import handling
* remove global np from alg_connectivity code
* fix black
* fix black
|
| |
|
|
| |
- tree_graph
- edgelist
|
| |
|
|
|
| |
* Remove IronPython code
* Remove Jython code
|
| |
|
| |
closes: #4188
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
|
|
| |
* Add edge label
* Add some tests to ensure label is a keyword attribute
Co-authored-by: Dan Schult <dschult@colgate.edu>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* MultiGraph from graphml with explicit edge ids #3470
Prior this commit, a graph with explicit edge ids
but no parallel edges stored in a graphml was converted to
a Graph and the edge ids were moved to the edge data.
This behaviour has been removed.
* clean up multigraph handling in read_graphml and friends
Added changes to parse_graphml too.
multigraph returned when parallel edges exist in file or when
new argument "force_multigraph" is True
* test parse_graphml and edge_key_type better and cleanup
* more tests
Co-authored-by: Dan Schult <dschult@colgate.edu>
|
| |
|
|
|
|
|
| |
* Fix parse_edgelist behavior with multiple attributes
* fixed test case
Co-authored-by: chris <chris@orchid>
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
* Add option for named key ids to GraphML writing.
* Remove 'is True' for PEP8 compliance.
* Added tests to confirm the named key ids are written as expected.
* Add test showing the read graph's nodes and edges are the same when written with both the default behavior and with the named id attributes.
Co-authored-by: dnp <you@example.com>
|
| |
|
|
|
|
|
|
|
| |
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 {} \;
|
| |
|
|
|
|
|
| |
* 3511 -- GML: Add type/enum for better readibility
* 3511 -- Always write multiple values to list
Fixes #3511
|
| | |
|
| |
|
|
|
|
|
|
| |
readwrite.tests.test_gexf.TestGEXF.test_numpy_type failed under Python
3.8 due to ordering of XML attributes, handle it as per f75dbe8. Also
change travis to no longer allow failures under 3.8.
Fixes #3720
|
| | |
|
| | |
|