| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
| |
This is a simple follow-up to #6471, and, as in that PR, this fix is short term.
We would like to find a more elegant, robust solution (probably after nx 3.1).
I sometimes forget there are two versions of `_dispatch`, and this PR fixes the
one that gets used when `NETWORKX_GRAPH_CONVERT` environment variable is set.
NetworkX does not yet test `test_override_dispatch`, so it's not easy to add
a test, but it gets used by external backends such as `graphblas_algorithms`.
Ideally, we should test this in NetworkX, which will require calling subprocess
in a test with an environment variable set.
|
| |
|
|
|
| |
* Ignore weakrefs when testing for memory leak
* Add educational comments about gc and weakrefs
|
| |
|
|
|
| |
* tweak _dispatch to allow func(G=G) pattern in signature
Co-authored-by: Erik Welch <erik.n.welch@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
* Run linter
|
| |
|
| |
Minor formatting fixups to get rid of doc build warnings.
|
| |
|
|
|
| |
* Fix_Typos
* Commit_Suggestions
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
| |
* Add clear edges method to the list of methods to be frozen by the nx.freeze function
* Change tests to create new graph instead of using class attribute
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Improve documentation for the View classes
* space removed
* use G instead of g
* update the line a few above to in_edges : InEdgeView or InEdgeDataView
* Minor tweaks to docstring, update summary.
* Apply similar changes to MultiDiGraph.in_edges docstring.
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fixes #6036
* test load centrality
* test dispersion
* test dispersion
* dispersion test
* test dispersion
* bug-fixes-for-issue-6088
* deleted
* bugfix for issue 6109
* deleting unrelated commits
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fixes #6036
* test load centrality
* test dispersion
* test dispersion
* dispersion test
* test dispersion
* bug-fixes-for-issue-6088
* deleted
* fixes-for-6119
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fixes #6036
* test load centrality
* test dispersion
* test dispersion
* dispersion test
* test dispersion
* bug-fixes-for-issue-6088
* deleted
* bug-fix-for-issue-6092
* bugfix-for-issue-6088
* bugfix-for-issue-6088
* bugfix-for-issue-6088
* bugfix-for-issue-6102
* bugfix-for-issue-6102
* bugfix-for-issue-6102
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fixes #6036
* test load centrality
* test dispersion
* test dispersion
* dispersion test
* test dispersion
* bug-fixes-for-issue-6088
* deleted
* bug-fix-for-issue-6092
* bugfix-for-issue-6088
* bugfix-for-issue-6088
* bugfix-for-issue-6088
* bugfix-issue-6088
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Touch up docstring.
* Condense conditional.
* Minor refactor of ispath test - parametrize and rm redundant.
* Add release note.
* Update networkx/classes/function.py
Co-authored-by: Dan Schult <dschult@colgate.edu>
Co-authored-by: Dan Schult <dschult@colgate.edu>
|
| |
|
|
|
|
| |
exception (#5943)
Formerly, is_path raised a KeyError when one of the nodes in the input path was not actually in G.
This PR modifies the function so that it returns False in this case instead of raising an exception.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Updated networkx/classes/function.py
* Reformatted using black
* Update networkx/classes/function.py
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Update networkx/classes/function.py
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Update networkx/classes/function.py
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Applying style manually
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Apply style manually
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Added example
* Updated
* Update case of multigraph and case of using G.edges to set H
* format doc_string example
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
Co-authored-by: Dan Schult <dschult@colgate.edu>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| | |
|
| | |
|
| |
|
|
|
| |
* Compare edges without worrying about order to work with pytest-randomly
* add another revert to make pytest randomly pass
|
| |
|
|
|
|
|
|
|
| |
* Update MG docstring to reflect rm_edges_from behavior.
Also adds example.
* Update remove_edge docstring in MG and MDG.
* Fix MDG examples.
|
| | |
|
| |
|
|
|
| |
* Add isort to pre-commit
* Run isort on all python files (except __init__.py ones)
|
| | |
|
| |
|
|
|
| |
* Fix __setstate__ for OutEdgeView subclasses, read _adjdict from state
* add a test to check cacheing and slots work together
|
| |
|
|
| |
* 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>
|
| | |
|
| |
|
|
|
|
|
|
|
| |
* Fixed the issue that the wrong dict factory on a MultiDiGraph was used for edge attributes (edge_key_dict_factory instead of edge_attr_dict_factory)
Extended tests to typecheck the dict factories and added a test that incorporates custom dict factories on a MultiDiGraph
* Mypy ignore inferred types in MDG subclass.
Co-authored-by: Fabian Ball <fabian@codagio.de>
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
| |
|
|
|
|
|
|
|
| |
* Correct typo in docstring (int -> float)
This is based on https://stackoverflow.com/q/71494698/10693596
* Update function.py
* Update function.py
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Updated MultiDiGraph documentation to include more examples of actually
using parallel edges, and fixed references to things like G[u, v] where
G[u, v, k] is required for a MultiDigraph. Have not made parallel
changes in MultiGraph which should maybe also be made?
Docs tests pass on my end; no code outside of comments was changed.
-Peter Mawhorter
* Updated docs for MultiGraph to add more multigraph-specific examples and
fix a few places where untested examples were wrong.
-Peter Mawhorter
* [DOC] fix typo
* add the right amount of separators
Co-authored-by: Mridul Seth <mail@mriduls.com>
|
| |
|
|
|
|
|
|
|
| |
using parallel edges, and fixed references to things like G[u, v] where
G[u, v, k] is required for a MultiDigraph. Have not made parallel
changes in MultiGraph which should maybe also be made?
Docs tests pass on my end; no code outside of comments was changed.
-Peter Mawhorter
|
| |
|
|
|
| |
* Fix missing backticks
* one more backticks
|