summaryrefslogtreecommitdiff
path: root/networkx/classes/multigraph.py
Commit message (Collapse)AuthorAgeFilesLines
* Lint using Ruff (#6371)danieleades2023-02-191-2/+1
| | | | | | | | | | | | | | | * 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>
* doc: update documentation when providing an iterator over current graph to ↵Sultan Orazbayev2022-12-121-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ThinGraph example to Multi*Graph doc_strings (#6160)nsengaw4c2022-11-091-0/+21
|
* Use scipy.sparse array datastructure (#6037)Jarrod Millman2022-10-121-2/+2
| | | | | | | | | | | | | | * 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>
* Move factory attributes to the class instead of instance. (#5850)Dan Schult2022-07-151-1/+0
| | | Move factory attributes to the class instead of instance. ?speedup?
* Remove OrderedGraphs (#5813)Jarrod Millman2022-07-121-5/+0
| | | | | | Removes the deprecated OrderedGraph classes. Co-authored-by: Ross Barnowski <rossbar@berkeley.edu> Co-authored-by: Dan Schult <dschult@colgate.edu>
* Touchups to MG and MDG edges docstrings. (#5708)Ross Barnowski2022-06-091-8/+12
|
* Update multigraph docstrings to reflect `remove_edges_from` behavior. (#5699)Ross Barnowski2022-06-081-5/+31
| | | | | | | | | * Update MG docstring to reflect rm_edges_from behavior. Also adds example. * Update remove_edge docstring in MG and MDG. * Fix MDG examples.
* 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-3/+4
| | | | * 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>
* Multigraph docs update (#5389)Peter Mawhorter2022-03-141-49/+89
| | | | | | | | | | | | | | | | | | | | | * 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>
* 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-1/+1
| | | | | | | | | | | | | * 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-6/+6
| | | | 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.
* Raise ValueError if None is added as a node. (#4892)Dan Schult2021-06-151-0/+4
| | | | | | | * 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
* add special processing of `multigraph_input` upon graph init (#4823)Dan Schult2021-05-271-2/+44
| | | | | | | | | | | | | | | | | | * add special processing of `multigraph_input` upon graph init Fixes: #4720 Adding a keyword argument `multigraph_input=True` to a graph construction call should treat any incoming input data for the graph as a dict-of-dict-of-dict multigraph data structure. Previously the multigraph_input argument would be added to the graph attribute dict and ignored when processing the input data. * Change default and add tests * make default try mgi=True, and if fails try mgi=False * copy parameter docstring to main class
* 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 to_undirected doc typo (#4821)Justin Cai2021-05-201-1/+1
|
* DOC: Switch from napoleon to numpydoc sphinx extension (#4447)Ross Barnowski2020-12-121-3/+0
| | | | | | | * Setup for numpydoc. * Add to doc requirements. * Replace napoleon with numpydoc in conf.py. * DOC: Fixups from numpydoc.
* Format python in docstrings (#4168)Jarrod Millman2020-08-191-65/+65
| | | | | | | | | | | | | | | | | | | * 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>
* MultiGraph from graphml with explicit edge ids #3470 (#3763)kiryph2020-08-161-2/+2
| | | | | | | | | | | | | | | | | | | | * MultiGraph from graphml with explicit edge ids #3470 Prior this commit, a graph with explicit edge ids but no parallel edges stored in a graphml was converted to a Graph and the edge ids were moved to the edge data. This behaviour has been removed. * clean up multigraph handling in read_graphml and friends Added changes to parse_graphml too. multigraph returned when parallel edges exist in file or when new argument "force_multigraph" is True * test parse_graphml and edge_key_type better and cleanup * more tests Co-authored-by: Dan Schult <dschult@colgate.edu>
* Format w/ blackJarrod Millman2020-07-101-12/+19
|
* Fix exception causes and messages all over the codebase (#4015)Ram Rachum2020-07-051-4/+4
|
* Update links to Py3 docs (#4042)Jarrod Millman2020-07-021-3/+3
|
* Update string formatJarrod Millman2020-01-011-4/+4
| | | | | | | | | find -name "*py" | xargs grep -n '" % ' find -name "*py" | xargs grep -n '"\.format(' find -name "*py" | xargs grep -n "' %" find -name "*py" | xargs grep -n 'msg % ' find -name "*py" | xargs grep -n ' %d ' find -name "*py" | xargs grep -n '\.format('
* Convert %-format to fstringJarrod Millman2020-01-011-2/+1
|
* 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 unused importsJarrod Millman2019-10-181-1/+0
|
* Update copyrightJarrod Millman2019-03-301-1/+1
|
* Replacing `Return` to `Returns` in docs for functions (#3301)Moradnejad2019-02-181-10/+10
| | | | | | * Fixed problem in documentation view of this function * Replacing `Return` to `Returns` in function docs
* implemented node_attr_dict_factory and graph_attr_dict_factory. (#3205)Ramil Nugmanov2018-10-271-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Simplify the Graphview and SubGraphView system (#3073)Dan Schult2018-07-201-88/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-1/+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-4/+2
| | | | | | 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-1/+1
| | | | | | | | | | 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
|
* change variable names to avoid kwargs clobber (#2824)Dan Schult2018-01-101-16/+16
| | | | | | | 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-5/+9
| | | 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
* Fix links (#2663)Jarrod Millman2017-09-111-3/+3
| | | | | | * Fix links * Comply with pep8
* Replace __class__ with fresh_copy in G.reverse and elsewhere (#2649)Dan Schult2017-09-071-1/+1
| | | | | Fixes #2648 Noticed hidden errors with G.name in operators.py
* Review and update tutorial/docs due to 2.0 changes (#2650)Dan Schult2017-09-071-50/+67
| | | | | | | | | | * Revamp tutorial.rst * update docs and simpliy nbunch usage * Revise base class docs * Read-through and tweak rst files
* Unravel subgraph chains (#2635)Dan Schult2017-08-261-10/+14
| | | | | | | | | | | | * Shortcut chains of subgraph views in common cases. Turns out the general case of chains of subgraph views is hard to make a shortcut for. So this only does the common case of node induced subgraphs of subgraphs. * Add tests for subgraph chains * Add more tests of chains of subgraphs
* Comply with pep8Jarrod Millman2017-08-171-8/+8
|
* Update docs of base class and function modules. (#2615)Dan Schult2017-08-151-55/+174
| | | Fixes #1208
* Simplify base classes. (#2604)Dan Schult2017-08-121-78/+6
| | | | | | | | | | * 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.