Skip to content

Add remove attribute functions - #7569

Merged
dschult merged 3 commits into
networkx:mainfrom
mjschwenne:update-attribute-functions
Aug 21, 2024
Merged

dschult merged 3 commits into
networkx:mainfrom
mjschwenne:update-attribute-functions

Conversation

@mjschwenne

Copy link
Copy Markdown
Contributor

With the addition of attribute based visualization, users may want to be able to remove visualization related attributes. I was a bit surprised that this functionality didn't already exist, but these are a pair of convenience functions to help with that.

@dschult dschult 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.

These two functions seem pretty reasonable. They'll be definitely useful for tests. And probably quite useful for certain user tasks.

@rossbar rossbar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Agreed, generally LGTM - thanks @mjschwenne !

One thing that occurred to me while looking at this - do we want to support removing attributes from a subset of nodes/edges? The set_*_attributes support this via passing in mappings. Generally this would be the type of feature that could be added incrementally... I only bring it up here because it may be trickier (though still possible) to modify the signature going forward since it makes use of argument unpacking.

WDYT @mjschwenne ? I don't have a strong feeling either way...

@mjschwenne

Copy link
Copy Markdown
Contributor Author

I hadn't thought about removing from a subset of the nodes or edges... I do think that it's a useful feature to have so I've added a parameter nbunch and ebunch keyword-only parameter to the functions to support this.

@dschult

dschult commented Aug 21, 2024

Copy link
Copy Markdown
Member

This has one approval and a nice review with all suggestions implemented (and tested).
I'm going to merge it to help other PRs that depend on this one.
Thanks @mjschwenne and @rossbar

@dschult
dschult merged commit c24b2f5 into networkx:main Aug 21, 2024
@dschult dschult added this to the 3.4 milestone Aug 28, 2024
rossbar pushed a commit to Peiffap/networkx that referenced this pull request Sep 6, 2024
* add remove_*_attributes

* add *bunch parameters
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