Skip to content

Bipartite layout nodes optional - #7756

Merged
MridulS merged 6 commits into
networkx:mainfrom
rossbar:bipartite-layout-nodes-optional
Feb 5, 2025
Merged

MridulS merged 6 commits into
networkx:mainfrom
rossbar:bipartite-layout-nodes-optional

Conversation

@rossbar

@rossbar rossbar commented Dec 4, 2024 •

Copy link
Copy Markdown
Contributor

A feature proposal to make the nodes parameter of bipartite_layout optional, with the default behavior to compute the nodesets with nx.bipartite.sets.

This is intended to be a minor convenience enhancement so users don't have to explicitly create partitions just to visualize the graph. This is only a proposal to add a feature and should be completely backwards compatible - including preserving the order of the nodes in the pos dict. I wasn't sure how important that was, but it's straightforward not to break!

I also added a draw_bipartite convenience function in 9196501 to match the pattern used for the other layout functions. I did so only for consistency and am completely happy to leave it out if preferred!

@rossbar rossbar added type: Enhancements Visualization Related to graph visualization or layout labels Dec 4, 2024
@rossbar
rossbar force-pushed the bipartite-layout-nodes-optional branch from 78e2012 to 9196501 Compare December 4, 2024 21:56
@rossbar
rossbar force-pushed the bipartite-layout-nodes-optional branch from 9196501 to 8c5116a Compare January 24, 2025 05:05
@rossbar

rossbar commented Jan 24, 2025

Copy link
Copy Markdown
Contributor Author

Rebased on main to incorporate store_pos_as!

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

This looks good. Thanks @rossbar

Comment on lines +1651 to +1654
"""


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.

Wait what? Where is the actual function implementation?

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.

also TIL:

def what_is_this():
    "lol what"

This is perfectly valid python code.

@rossbar
rossbar force-pushed the bipartite-layout-nodes-optional branch from 8c5116a to 1f70ffb Compare February 3, 2025 02:51
@rossbar
rossbar force-pushed the bipartite-layout-nodes-optional branch from 1f70ffb to 79621a3 Compare February 3, 2025 02:53
Comment thread networkx/drawing/tests/test_pylab.py Resolved
@MridulS
MridulS merged commit 64ce49c into networkx:main Feb 5, 2025
@jarrodmillman jarrodmillman added this to the 3.5 milestone May 29, 2025
@rossbar
rossbar deleted the bipartite-layout-nodes-optional branch November 19, 2026 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: Enhancements Visualization Related to graph visualization or layout

Development

Successfully merging this pull request may close these issues.

4 participants