Skip to content

DEP : adding not_implemented_for("multigraph”) to k_core, k_shell, k_crust and k_corona - #7121

Merged
dschult merged 3 commits into
networkx:mainfrom
Schefflera-Arboricola:dep_k_cores
Nov 30, 2023
Merged

dschult merged 3 commits into
networkx:mainfrom
Schefflera-Arboricola:dep_k_cores

Conversation

@Schefflera-Arboricola

@Schefflera-Arboricola Schefflera-Arboricola commented Nov 17, 2023 •

Copy link
Copy Markdown
Member

In the first commit, I have deprecated the behavior of the above four k_ functions to not take a MultiGraph object as an argument.

The above four functions are not defined for a multigraph so it would be appropriate to add a not_implemented_for("multigraph”) decorator and strictly not allow a MultiGraph object to avoid any confusion about multigraph and MultiGraph class.

Also, when the core_number dictionary is not passed as an argument in these functions and a MultiGraph object is passed, then a NetworkXNotImplemented exception is raised. But, when the core_number dictionary is given then the same MultiGraph graph won't raise any exceptions. So, to avoid this kind of inconsistent behavior we should add the decorator.

In the second commit, I have just added some more tests for the other functions in core.py.

origin : #7027

Thank you :)

@Schefflera-Arboricola
Schefflera-Arboricola marked this pull request as draft November 17, 2023 20:36
@Schefflera-Arboricola
Schefflera-Arboricola marked this pull request as ready for review November 17, 2023 20:50
@MridulS MridulS added this to the 3.3 milestone Nov 29, 2023

@MridulS MridulS left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks @Schefflera-Arboricola

@dschult
dschult merged commit 6bfea96 into networkx:main Nov 30, 2023
cvanelteren pushed a commit to cvanelteren/networkx that referenced this pull request Apr 22, 2024
…l`, `k_crust` and `k_corona` (networkx#7121)

* DEP 4 k_ functions

* added a few more tests

* bug : replaced nx.is_multigraph(G) with G.is_multigraph()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants