| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Any keys in mapping that are not nodes in the graph are now ignored instead
of raising a KeyError
|
|
|
|
|
| |
* 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>
|
|
|
|
|
|
|
|
|
|
|
| |
* relabel_nodes now preserves edges in multigraphs
* fix pep8 and doctest
* Add tests that show trouble with inplace edge overwriting
* fix errors shown by tests for inplace overwriting
Co-authored-by: Dan Schult <dschult@colgate.edu>
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Simplify the Graphview and SubGraphView system
- add tests to show that extensions of base graph classes (only add new functions)
should be able to use the Graph.subgraph and Graph.copy methods easily
- Remove ReadOnlyGraph class in favor of existing freeze() function
- Switch all GraphView classes to generic_graph_view function
- Switch all SubGraph classes to subgraph_view function
- Introduce deprecated functions that act like the deprecated classes.
Still need to:
- add docs
- add tests
- make sure backward compatible and marked as deprecated
- remove GraphView and SubGraph construct from rest of codebase
- update release docs
Fixes #2889
Fixes #2793
Fixes #2796
Fixes #2741
* Ease subclassing for to_(un)directed
- add to_directed_class indicator functions to base classes
- start deprecating G.fresh_copy
- update function.to(un)directed
* Remove G.fresh_copy from code replace with __class__
Add deprecation warnings for GraphView classes, ReverseView and
SubGraph. Also for fresh_copy function.
|
|
|
|
|
|
| |
* Added clarifying comment about relabelling nodes in situations where the order of nodes is important
* wrap docstring
|
| |
|
| |
|
|
|
|
|
|
| |
It's too hard to keep G.name consistently updated
throughout the codebase. Let users do it.
This stops from deprecating G.name altogether, but
it is a first step toward that if we decide to go that route.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
| |
Fixes #2648
Noticed hidden errors with G.name in operators.py
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* make set_node_attriutes() work with any kind of container
* switch arguments in docstring and adapt comments
* Make set_edge_attributes() with any kind of container
* Update release notes with #2553 set/get_node/edge_attributes
* Update package codebase with API change for set_*_attributes
Fixes #2343
|
|
|
|
|
|
| |
* Ensure _relabel_copy() respects node order of OrderedGraphs, fixes #2482
* Comply with pep8
|
|
|
| |
Fixes #2477
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#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
|
|
|
|
|
| |
Fixes #2134
simplifies read_gml handling of "name" as well.
|
|
|
|
|
|
|
|
| |
I also went through and modified all attr_dict references to either
directly assign keywords to node/edge attributes, or use the ** syntax
to unpack the dictionaries. The only case of these I couldn't do is
networkx.convert.py -- largely because I don't understand how multigraph
edges work.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rewrote topolgical_sort as a generator:
* It no longer accepts reverse or nbunch arguments
* It is slightly faster.
Added lexicographical_topological_sort, which accepts a key.
Some tests for topological sort were removed because they relied on
CPython's particular dict element ordering.
Added utils from more_itertools:
* These were necessary for working with the new generators.
* "pairwise" is equavalent to zip(some_list, some_list[1:]) -- for
generators.
* "consume" consumes an iterator.
|
|
|
|
| |
iterator for else
|
| |
|
|
|
|
|
|
|
| |
Previously `Graph.nodes()` returned a list of nodes and
`Graph.nodes_iter()` returned an iterator over nodes. With this commit,
the former function now returns an iterator and the latter no longer
exists.
|
| |
|
|
|
| |
because otherwise `old == target and new` with old equal to target will evaluate to new. If new is 0 (a valid integer node), then the conjunction evaluates to False, masking that old is equal to target. The ternary operator implements the selection and avoids this issue.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Use node attribute (specified as "label_attribute") in convert_node_labels_to_integers() instead of adding a mapping dict attribute to the Graph object.
Addresses #820
|
|
|
|
|
|
|
|
|
|
| |
Addresses #741
There may still be more that need fixing since
1) NumPy and some other optional packages do not yet work with Python3.3 so those tests weren't checked
2) Finding these errors by running the tests is nondeterministic itself (e.g. passes 4 times and fails on the 5th). And inspecting all of the tests by hand is error-prone too.
|
|
|
|
| |
Fixes #674
|
| |
|
|
|
|
| |
Addresses #525
|
|
|
|
| |
Fixes #525
|
|
Addreses #525
--HG--
rename : networkx/tests/test_convert.py => networkx/tests/test_relabel.py
|