| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
| |
* Docstr examples for compute-v-structures
* Removed unnecessary example
|
| | |
|
| |
|
|
|
| |
* Update developer requirements
* Run linter
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
tests (#5988)
* Fix weighted MultiDiGraphs in dag longest path algorithms
* Add tests for MultiDiGraphs in dag longest path tests
* Test non default default_weight
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Test non default default_weight
* blackify
Co-authored-by: Mridul Seth <mail@mriduls.com>
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Co-authored-by: Mridul Seth <git@mriduls.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Ran black
* Add unit tests
* Rename and fix citation
* Black
* Fix unite tests
* Isort
* Add algo description
* Update networkx/algorithms/tests/test_d_separation.py
* Update networkx/algorithms/traversal/breadth_first_search.py
* Address dans comments
* Fix unit tests
* Update networkx/algorithms/tests/test_d_separation.py
Co-authored-by: Dan Schult <dschult@colgate.edu>
* Apply suggestions from code review
Co-authored-by: Dan Schult <dschult@colgate.edu>
* Update networkx/algorithms/dag.py
Co-authored-by: Dan Schult <dschult@colgate.edu>
* Update networkx/algorithms/dag.py
Co-authored-by: Dan Schult <dschult@colgate.edu>
* Fix comments
* Clean up the docs a bit more
* Merge
Co-authored-by: Dan Schult <dschult@colgate.edu>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* docstring update to lex-topo-sort
- explain effect and purpose for lexi sort
- add hints for fixing non-sortable nodes
- add hint to exception msg
- Add examples
* Shorten the first line of the doc_string
Co-authored-by: Dan Schult <dschult@colgate.edu>
* Generalize the description of sort failures
Co-authored-by: Dan Schult <dschult@colgate.edu>
* more succinct description of key function
Co-authored-by: Dan Schult <dschult@colgate.edu>
* improve description of key function
Co-authored-by: Dan Schult <dschult@colgate.edu>
* Black'd it.
Co-authored-by: Dan Schult <dschult@colgate.edu>
|
| |
|
|
|
|
|
|
|
| |
The ancestors and descendants functions do not include the source in the
returned nodes. Better document this fact, and add an example to show how
source can be included if desired.
Co-authored-by: dtuncturk <dilaramemis@sabanciuniv.edu>
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)
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
| |
|
|
| |
* Adding multigraph support to function `transitive_closure`
* Improve performance
|
| |
|
|
|
|
|
|
|
|
|
| |
* Adding examples to docstrings
* Examples rewritten according to comments
* Update linebreaking + wording in is_aperiodic examples.
* style-nit: lengthen lines in transitive_closure examples.
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
| |
|
|
|
|
|
| |
dag.py (#5017)
* Improved functions `ancestors` and `descendants`
* `descendants` and `ancestors` work correctly and are well-defined for the Graph
|
| |
|
|
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
attributes (#4684)
* Adding reformatting by pre-commit hook
* Revert "Adding reformatting by pre-commit hook"
This reverts commit 8bf27bf58cb6a062b405b7b73af4304a1f356dfe.
* Updated docstring to include note about unnecessary data copies and example for basic usage and attribute copying.
* Explanation moved to example, for context
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Deprecate generate_unique_node
and add to contributing doc steps for deprecation
* Change the API of prefix_tree since root not UUID
Updated doc_strings, comments, and removed `NIL` variable in trees.py
Changed return value of prefix_tree to `tree` from `tree, root`
* Add release_dev.rst to deprecations how-to list.
* added suggestions
I rewrote the prefix_trees paragraphs again to bring the description
more fully out of the "Returns" section and up to the front.
This intends to make the nodes and "source" attributes more clear.
* Fix some rst formatting.
Co-authored-by: Jarrod Millman <jarrod.millman@gmail.com>
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Co-authored-by: Jarrod Millman <jarrod.millman@gmail.com>
|
| |
|
|
|
| |
Update parameter description to DiGraph instead of DAG
Co-authored-by: Dan Schult <dschult@colgate.edu>
|
| | |
|
| |
|
|
|
| |
* Add test for unfeasible relabeling
* Slightly clarify docstrings
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| | |
|
| | |
|
| |
|
|
| |
find networkx -name \*.py -exec pyupgrade --py36-plus {} \;
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
(#3613)
Fixes #3187
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* added functions transitive_closure_dag and descendants_at_distance to dag.py
* added new function names to __all__ in dag.py
* fixed typo in docstring
* added test for transitive_closure_dag
* using new function in antichains, which requires input graph to be a DAG
* added topo_order parameter to transitive_closure_dag
changed antichains function to take advantage of it
* modifications according to dschult's suggestions
* minor pep8 fix
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Add 'NodeId' to the tuple to handle the cases where keys are same for two or more nodes
* Add tests for issue #3493
* consider 'nodeid' while unpacking the tuple from list
* minor changes for PEP8/pycodestyle
* allow arbitrary order of list(G) for py3.5 tests
Fixes #3493
|
| |
|
| |
Fixes #3446
|
| | |
|
| |
|
|
|
|
| |
* Fixed problem in documentation view of this function
* Replacing `Return` to `Returns` in function docs
|
| |
|
|
|
|
|
|
| |
* speed up transitive_reduction function
Relates to #3032
* tweak transitive_reduction a little more
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Implement a recursive algorithm for enumerating all topological sorts.
* Add test instances
* Implement itertive algorithm to enumerate all topological sorts.
* Replace recursive algorithm.
* Fix docstring, add missing lines.
* Improve docstring.
* Use append to make code more idiomatic.
* More idomatic python.
* Change implmentation to work for multigrahs.
* Iterate over out_edges.
* Use correct example.
|
| |
|
| |
relates to discussion in #3043
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is #2060 with conflicts resolved. Fixes #2060
This commit adds two new functions and an example application using
those functions.
- The `prefix_tree` function (in the new module
`networkx/generators/trees.py`) generates a prefix tree (aka a trie)
from a given list of strings (or integers, etc.).
- The `dag_to_branching` function in `networkx/algorithms/dag.py`
creates the branching that results from interpreting the list of all
paths from root nodes to leaf nodes in the DAG as the root-to-leaf
paths in a prefix tree.
- The example application of the `dag_to_branching` function, in the
`examples/applications/circuits.py` module, demonstrates how to
convert a Boolean circuit into an equivalent Boolean formula.
|
| |
|
| |
Fixes #2578
|
| |
|
|
|
|
|
|
|
| |
* Fix dag_longest_path bug
Fix a bug in dag_longest_path that raises an exception when an empty
graph is given.
* Adding test for empty graph
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Added all_pairs_dijkstra
* Finds shortest weighted paths and lengths between all nodes.
* Returns an iterator of dictionaries, keyed by source nodes.
* Each dictionary essentially contains the value of
single_source_dijkstra computed at the source node.
The tuple that single_source_dijkstra returns is unpacked
and saved as values to two keys: 'distance' and 'path'.
* fixed doctest error
* shortest_path return types as discussed for #2510
This commit only handles the following:
Changed to return a dict:
- multi_source_dijkstra_path_length
- single_source_bellman_ford_path_length
Changed to yield 2-tuples:
- all_pairs_shortest_path
changed to return dicts:
- single_source_shortest_path_length
- single_target_shortest_path_length
The following are in #2510:
Still need these to yield 2-tuples:
- all_pairs_dijkstra_path
- all_pairs_bellman_ford_path
Need to add this (and yield 2-tuple):
- all_pairs_dijkstra
* add/update the all_pairs_dijkstra functions
* fix doctest
|