summaryrefslogtreecommitdiff
path: root/networkx/classes/digraph.py
Commit message (Collapse)AuthorAgeFilesLines
* Lint using Ruff (#6371)danieleades2023-02-191-3/+3
| | | | | | | | | | | | | | | * 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>
* Fix docstrings (#6329)Jarrod Millman2023-01-041-2/+2
|
* fix warnings for make doctest (#6323)Dan Schult2023-01-041-1/+1
|
* doc: update documentation when providing an iterator over current graph to ↵Sultan Orazbayev2022-12-121-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Di graph edges doc fix (#6108)nsengaw4c2022-11-141-2/+11
| | | | | | | | | | | | | | | * 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>
* Use scipy.sparse array datastructure (#6037)Jarrod Millman2022-10-121-1/+1
| | | | | | | | | | | | | | * 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>
* Attempt to reverse slowdown from hasattr needed for cached_property (#5836)Dan Schult2022-07-161-9/+55
| | | | | | | | | | | | | | | | | * 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. (#5850)Dan Schult2022-07-151-7/+0
| | | Move factory attributes to the class instead of instance. ?speedup?
* Remove OrderedGraphs (#5813)Jarrod Millman2022-07-121-6/+0
| | | | | | Removes the deprecated OrderedGraph classes. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> Co-authored-by: Dan Schult <dschult@colgate.edu>
* Use isort with pre-commit to enforce import guidelines (#5659)Mridul Seth2022-06-021-4/+4
| | | | | * Add isort to pre-commit * Run isort on all python files (except __init__.py ones)
* Cache edges, degree, adj properties of Graph classes (#5614)Dan Schult2022-05-111-9/+21
| | | | * Make all graph properties cached properties * one test function is not needed due to test inheritance
* Update .degree() docs: outdated return type (#5529)Brit2022-04-281-7/+4
| | | | | | 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>
* Fix missing backticks (#5381)Matthias Bussonnier2022-03-091-2/+2
| | | | | * Fix missing backticks * one more backticks
* More numpy.matrix cleanups for NX2.7 (#5319)Ross Barnowski2022-02-121-4/+4
| | | | | | | | | | | | | | | | | | | * Fix return type in docstring of internal function. * Rm explicit mention of numpy matrix from class docstrings. * Fix return type of floyd_warshall_numpy docstring. * Remove mention of numpy matrix from code comment. * Fix simrank similarity internal docstring. * Rm explicit mention of matrix in favor of 2D array. * Update to_networkx_graph array exception wording. * Remove extraneous mention of numpy matrix. * Don't print array in exception message.
* Fixed inconsistent documentation for nbunch parameter in DiGraph.edges() (#5037)Anutosh Bhat2021-12-121-3/+3
| | | | | | | | | | | | | * Fixed inconsistent documentation for nbunch parameter in DiGraph.edges() * Resolved Requested Changes * Revert changes to degree docstrings. * Update comments in example. * Apply wording to edges method in all graph classes. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* Change exception varname e to err (#5130)Dan Schult2021-10-151-8/+8
| | | | 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 graph_class usage in to_undirected method (#4912)Tomohiro Endo2021-06-221-2/+2
| | | | | * fix error in the tests... now original code fails test Co-authored-by: Dan Schult <dschult@colgate.edu>
* Raise ValueError if None is added as a node. (#4892)Dan Schult2021-06-151-0/+12
| | | | | | | * Raise ValueError if None is added as a node. Removed some tests that checked that errors raised when None was a node. * update tutorial to make a stronger statement about None
* Fix bad import pattern (#4839)Ross Barnowski2021-05-261-0/+2
| | | | | | | | | | | * Add a test to catch importing aliases. * Add test for another bad import pattern. * Fix one bad import pattern. Adds __all__ to some modules where it was missing. * RM networkx namespace test.
* Fix docstrings and remove unused variables (#4501)Andrea Tomassilli2021-01-091-1/+1
| | | | Co-authored-by: Dan Schult <dschult@colgate.edu> Co-authored-by: Ross Barnowski <rossbar@berkeley.edu>
* DOC: Switch from napoleon to numpydoc sphinx extension (#4447)Ross Barnowski2020-12-121-5/+4
| | | | | | | * Setup for numpydoc. * Add to doc requirements. * Replace napoleon with numpydoc in conf.py. * DOC: Fixups from numpydoc.
* Format w/ black==20.8b1Jarrod Millman2020-10-061-2/+2
|
* rewrite add_nodes_from to relax code meant to allow ironpython pre-2.7.5 (#4200)Dan Schult2020-09-101-22/+11
|
* Format python in docstrings (#4168)Jarrod Millman2020-08-191-45/+47
| | | | | | | | | | | | | | | | | | | * 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>
* Format w/ blackJarrod Millman2020-07-101-21/+29
|
* Fix exception causes and messages all over the codebase (#4015)Ram Rachum2020-07-051-8/+8
|
* Add method to clear edges only (#3477)Paolo Lammens2020-07-051-0/+19
| | | | | | | | | | | | | | | | | | | | | | | * feat: `clear_edges` in `networkx.Graph` Method to clear all edges in a graph without altering nodes or graph attributes. Added corresponding test too. * tests: improve `test_clear` in `TestGraph` Added a graph attribute before clearing to test its proper deletion. too. * tests: add tests for `clear` and `clear_edges` specific to DiGraph To test that DiGraph-specific edge records are cleared as well. * fix: specific `clear_edges` for `DiGraph` So that DiGraph's pred/succ also get cleared. * Convert docstrings tests and docs reference links to add clear_edges Co-authored-by: Dan Schult <dschult@colgate.edu>
* Update links to Py3 docs (#4042)Jarrod Millman2020-07-021-1/+1
|
* Remove whitespace (#3816)Whi Kwon2020-02-061-1/+1
|
* Convert %-format to fstringJarrod Millman2020-01-011-6/+5
|
* Remove boiler plate from top of modulesJarrod Millman2019-11-111-10/+0
| | | | | | | | | 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.
* remove tests of deprecated views and fix use of deprecated G.nodeDan Schult2019-10-121-1/+1
|
* Update copyrightJarrod Millman2019-03-301-1/+1
|
* Replacing `Return` to `Returns` in docs for functions (#3301)Moradnejad2019-02-181-8/+8
| | | | | | * Fixed problem in documentation view of this function * Replacing `Return` to `Returns` in function docs
* replace deprecated fresh_copy with __class__ (#3278)Antoine Prouvost2018-12-241-1/+1
|
* Replaced deprecated usage of ReverseView with reverse_view (#3256)Øyvind Heddeland Instefjord2018-11-261-1/+1
|
* implemented node_attr_dict_factory and graph_attr_dict_factory. (#3205)Ramil Nugmanov2018-10-271-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #3204 * implemented node_attr_dict_factory and graph_attr_dict_factory. * documentation added. fixed test errors. * implemented attr factory for all classes. from add_edges_from and add_nodes_from removed duplicate code. from copy removed useless dict copying. * fixed tests errors. * fixed tests errors in all graphs. * ValueError fixed. potential add_nodes_from usage error fixed. * typo fixed. * review fixes: * Leave the assignments which move the class variables that hold factories to instance variables. * Leave the node checking with self._succ and self._adj. * Leave the code that adds the node in add_nodes_from rather than pushing it to add_node. * Leave the code to add edges in add_edges_from rather than off-loading to add_edge. * Leave the code in copy unchanged. for multidigraph add_edges_from implemented for multigraph add_edges_from don't use add_edges * typo fixed. * leave copy as is * removed all fixes for next PR.
* doc: extend documentation for methods predecessors and successors. (#3114)Leo Torres2018-08-071-1/+38
| | | Fixes #3113
* Fix adjlist factory bug in DiGraph (#3101)Dan Schult2018-07-311-4/+4
| | | | | | | | * Fix bug in adjlist factories for DiGraph Fixes #3099 * Add test for factory class attributes.
* Simplify the Graphview and SubGraphView system (#3073)Dan Schult2018-07-201-166/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* Update docs for G.copy and set_*_attributes. (#3024)Dan Schult2018-06-191-8/+7
| | | | | | | | | | | | | | | | | | | | | | * Update docs for G.copy and set_*_attributes. Fixes #2899 and #2859 * fix tutorial and docs of to_*directed Fixes #2849 * fix docs for asyn_fluidc Fixes #2845 * Allow seed to change in connected_watts_strogatz_graph Also update docs. Fixes #2809 * Add tests for exceptions to asyn_fluidc * Add tests for random graphs
* speedup of filters for induced subgraph (#3017)Dan Schult2018-06-171-0/+20
| | | | | | | | | | | | | | * speedup of filters for induced subgraph Check if induced node set is big or small to determine lookup method. Also add subgraph docs to warn that building the subgraph from scratch may be better and give alternate code to use for this. Fixes #2887 * Add tests of subgraph filter objects * propagate subgraph doc changes to all base classes
* Remove cyclic reference in G.root_graph (#3014)Dan Schult2018-06-161-2/+1
| | | | | | | | * Remove a second cyclic reference in G.root_graph Related to #3011 and #2885 and maybe #2793 * Add tests for memory leaks due to copy()
* Remove circular references between graphs and views. (#3011)Dan Schult2018-06-141-30/+5
| | | | | | Graphs no longer have references to views. Views still have references to the graph. This should ease subclassing the base graph classes because you don't have to worry about creating memory leaks.
* Misc. typos (#2872)luzpaz2018-02-141-2/+2
| | | | | | | | | | Found via `codespell -q 3 -I ../networkx-whitelist.txt` where whitelist consisted of: ``` ans childs iff nd te ```
* Update copyrightJarrod Millman2018-01-201-1/+1
|
* Remove automatic processing of G.name attribute (#2829)Dan Schult2018-01-141-2/+0
| | | | | | 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.
* change variable names to avoid kwargs clobber (#2824)Dan Schult2018-01-101-26/+26
| | | | | | | I didn't change functions defined in tests. I also left drawing routines as is at least for now. Addresses #1582 Fixes #1583
* Adjust docs for graph class edge attrib assignment (#2817)Dan Schult2018-01-081-2/+4
| | | As suggested by @mddddd in #2728
* Speedups for subgraph and copy methods (#2744)Dan Schult2017-11-091-3/+3
| | | | | Fixes #2743 Addresses #2716 Relates to #2687