| 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 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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add deprecated directive to reversed docstring.
* Add missing dep directives to shpfiles.
* Remove defn of INF sentinel.
* typo.
* str -> comment in forloop.
* STY: appropriate casing for var name.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix links, use DOI links, wayback machine where required
* Add nx-guides to intersphinx mapping.
* Replace external mpl link w/ intersphinx.
* Update mpl intersphinx mapping.
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
|
|
|
| |
Co-authored-by: Dan Schult <dschult@colgate.edu>
Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
|
|
|
| |
Co-authored-by: atomassi <andrea.tomassilli@sky.uk>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
|
|
|
|
|
|
| |
* Fix exception causes and messages in 12 modules
* Remove deprecated matplotlib.use(warn=False) that was default anyway.
Co-authored-by: Dan Schult <dschult@colgate.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.
|
| |
|
| |
|
|
|
|
|
|
| |
* Fixed problem in documentation view of this function
* Replacing `Return` to `Returns` in function docs
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Import ABCs from collections.abc
Importing Abstract Base Classes directly from the collections module is
deprecated in python 3.8 in favour of the collections.abc module.
Importing from collections is the only option on python 2.7, though.
This PR tries to import ABCs from collections.abc, and fallback to
collections in case of failure.
Fixes #3170
* Fix forgotten ABC
* Let go python 2.7 compatibility for ABC imports
Previous changes replaced import of ABCs from collections to imports
from collections.abc. Though, the changes fell back on bare imports from
colelctions in python 2.7.
In
<https://github.com/networkx/networkx/issues/3170#issuecomment-443514900>,
@dschult comments that the support for python 2.7 is dropped. So this
commit drops the fall back.
|
|
|
|
|
|
|
|
|
|
| |
Found via `codespell -q 3 -I ../networkx-whitelist.txt` where whitelist consisted of:
```
ans
childs
iff
nd
te
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* use dict comprehensions in kcomponents.py
* use dict comprehensions in test_kcomponents
* use dict comprehensions in test_kcutsets
* use dict comprehensions in test_maxflow
* use dict comprehensions in test_maxflow_large_graph
* use dict comprehensions in flow/utils.py
* use dict comprehensions in weighted.py
* use dict comprehensions in graphml.py
* use dict comprehensions in nx_pylab.py
* use dict comprehensions in relabel.py
* use dict comprehensions in assortavity/mixing.py
* conform to pep8 guidelines in mixing.py
* Minor tweaks to kcomponents to update to v2.0
|
| |
|
|
|
|
|
|
| |
* Fix links
* Comply with pep8
|
|
|
|
|
|
|
|
|
|
| |
* move selfloop methods out of graph classes into function.py
* replace G.node with G.nodes. fix Pickle of views
* Replace G.edge with G.edges
* Add a few lines of docs for release realted to this PR.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Update code to prepare for melding graphviews
* Meld graphviews into graph classes
* Cleanup subgraph calling sign. and remove duplicate code
* Add some tests for raising exceptions
* update edge_kcomponents to avoid readonly views.
* Add root_graph attribute and tests
Update tests for root_graph as well as fresh_copy.
I left fresh_copy as an attribute even with root_graph
because a view might switch the data structure of the
view from directed to undirected. Going to the root_graph.__class__
may not give you what you need to create a graph like the view.
Fresh_copy gives a null graph with the directed/multi type of that
view or graph.
|
|
|
|
|
|
|
|
| |
* adjust some of the slowest tests. minor speedup of is_connected.
* Add adj property to AntiGraph class in kcomponents.py
* Add comment to explain why test loop only goes once
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add reversed/to_directed/to_undirected views
Refactor views. Add tests.
* correct treatment of slots in coreviews
* Add tests for subgraph filters and to show #2048 reported bug
The bug in #2048 would be fixed by the subgraph view machinery.
* Fix to_(un)directed when already that direction
* Rename subgraph module to avoid conflict
* Simplify subgraphviews and tests
* refactor subgraphviews to fit coreviews structure
* Move subgraphviews into graphviews
* Rename views.py to reportviews.py
* Move functions out of views modules into function.py and simplify
* separate contextmanager from views for now.
* Fix induced_subgraph in function.py
* get reshuffle of modules right
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#2475)
* Dont assume iterators for nodes/edges/degrees (prep for views)
* Add graph view classes for nodes/edges/degree
* Add right set operations (not present in python3.3 KeysView
* Add nodes before adding edges so python36 tests work
By only adding edges, the nodes were added in order (0,1,3,2)
and with the ordered nature of python3.6 dicts the tests failed.
Could also fix by using nodelist on each call to to_convert_...
* weighted graph convert tests testing empty graphs
The edge iterator was exhausted for source before being used for dest
* allow DegreeView to include case of nbunch
* Make node/edge/degree properties of Graph
* View contains fix and Viewers can return self. More tests
* Add more tests including one for #2347
* Add nbunch tests and pep8
* Rename to EdgeView and EdgeDataView
* docs tweaks and pep8
* fix up nodeDataView contains. Add and clean up tests.
* Change the graph attributes to read-only properties
* Reframe views code and extend _node to all networkx (still need
examples)
* Clean up and pep8 for view changes
* ername AtlasViews, simplify code and add docstrings
* Make G[u] return a view, and catch some doc bugs
* Update views to use _node,_adj. Add len to EdgeDataView
* minor adjustments to example subclass/printgraph
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Dont assume iterators for nodes/edges/degrees (prep for views)
* Add graph view classes for nodes/edges/degree
* Add right set operations (not present in python3.3 KeysView
* Add nodes before adding edges so python36 tests work
By only adding edges, the nodes were added in order (0,1,3,2)
and with the ordered nature of python3.6 dicts the tests failed.
Could also fix by using nodelist on each call to to_convert_...
* weighted graph convert tests testing empty graphs
The edge iterator was exhausted for source before being used for dest
* allow DegreeView to include case of nbunch
* Make node/edge/degree properties of Graph
* View contains fix and Viewers can return self. More tests
* Add more tests including one for #2347
* Add nbunch tests and pep8
* Rename to EdgeView and EdgeDataView
* docs tweaks and pep8
* fix up nodeDataView contains. Add and clean up tests.
* Tweaks to improve speed for nodes and edges.
* improve views dependence on ABCs, remove len from dataviews
* First pass on docs in views.py
* Change property to lazy attribute
|
| |
|
| |
|
| |
|
|
|
|
| |
iterator for else
|
| |
|
|
|
|
|
|
|
| |
Simplifyed the approximation to `k_components` by removing the exact
parameter. This was useful in my experiments but in practice is slower
than the exact `k_components` build on top of `all_node_cuts` for most
graphs.
|
|
|
|
| |
Avoid unnecessary method calls.
|
| |
|
|
This is an approximation approach to compute the k-component structure
of a graph (#1414 is the exact, and slow, version of this). I wrote a
paper to explore this approach in detail, see http://arxiv.org/abs/1503.04476
The logic of the approximation algorithm for computing the `k`-component
structure is based on repeatedly applying simple and fast algorithms
for `k`-cores and biconnected components in order to narrow down the
number of pairs of nodes over which we have to compute White and Newman's
approximation algorithm for finding node independent paths (implemented at #1405).
More formally, this algorithm is based on Whitney's theorem, which states
an inclusion relation among node connectivity, edge connectivity, and
minimum degree for any graph G. This theorem implies that every
`k`-component is nested inside a `k`-edge-component, which in turn,
is contained in a `k`-core. Thus, this algorithm computes node independent
paths among pairs of nodes in each biconnected part of each `k`-core,
and repeats this procedure for each `k` from 3 to the maximal core number
of a node in the input graph.
Because, in practice, many nodes of the core of level `k` inside a
bicomponent actually are part of a component of level k, the auxiliary
graph needed for the algorithm it's likely to be very dense. Thus, we use
a complement graph data structure to save memory (`_AntiGraph` see #599
for an earlier dicussion about this). AntiGraph only stores information
of the edges that are *not* present in the actual auxiliary graph.
However, when applying algorithms to this complement graph data structure,
it behaves as if it were the dense version. So it can be used directly
in several NetworkX algorithms, this version is only tested for the
algorithms needed here: `connected_components`, `k-cores`, and
`biconnected_components`. I used a `ThinGraph` for building the `AntiGraph`
and the memory consumption is quite small compared with a regular `Graph`.
I think `AntiGraph` is not useful enough to be a top level class in NetworkX,
but it could be a good example of a `Graph` subclass. I'll add to the
examples folder.
This PR supersedes and closes #580.
|