Skip to content

Error or warn if we have a disconnected network - #154

Merged
IAlibay merged 10 commits into
mainfrom
fix-disconnected
Jun 12, 2026
Merged

IAlibay merged 10 commits into
mainfrom
fix-disconnected

Conversation

@IAlibay

@IAlibay IAlibay commented Jun 11, 2026

Copy link
Copy Markdown
Member

Added 'allow_disconnected' parameter to enable creation of disconnected networks and included warnings for disconnected networks.

Added 'allow_disconnected' parameter to enable creation of disconnected networks and included warnings for disconnected networks.
@IAlibay

IAlibay commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

pre-commit.ci autofix

@IAlibay IAlibay changed the title [wip] Error or warn if we have a disconnected network Error or warn if we have a disconnected network Jun 11, 2026
@IAlibay

IAlibay commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

pre-commit.ci autofix

@IAlibay
IAlibay requested a review from hannahbaumann June 11, 2026 13:10

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

Thanks @IAlibay this looks good! Just left that comment regarding the error message.


if not ln.is_connected():
if not allow_disconnected:
errmsg = "Failed to create a connected network where all nodes are either directly or undirectly connected to each other."

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.

Suggested change
errmsg = "Failed to create a connected network where all nodes are either directly or undirectly connected to each other."
errmsg = "Failed to create a connected network where all nodes are either directly or indirectly connected to each other."

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.

Or maybe undirectly is a word?

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.

I wonder if there's a good way to help the user understand why/what it not connected, e.g. listing the ligand(s) that are separate or the cluster sizes. If the network is large and e.g. 50 ligands are disconnected from 50 other ligands (two separate networks), then it would not make sense to list the ligands individually, but if one or two ligands are separate from the rest, it would be helpful. I'm not sure, what do you think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Or maybe undirectly is a word?

Nope, just me being unable to spell. Fixed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I wonder if there's a good way to help the user understand why/what it not connected, e.g. listing the ligand(s) that are separate or the cluster sizes. If the network is large and e.g. 50 ligands are disconnected from 50 other ligands (two separate networks), then it would not make sense to list the ligands individually, but if one or two ligands are separate from the rest, it would be helpful. I'm not sure, what do you think?

I see what you mean here - I'm really not sure how to do that cleanly though :/ As you say, it's impossible to know what nodes will be disconnected, that could easily become a nightmare.

How about telling them they can get the disconnected network to inspect if they call the method with allow_disconnected? What do you think @hannahbaumann ?

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.

Yes that sounds great!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done, I think 😅 - let me know how it looks!

IAlibay and others added 2 commits June 11, 2026 14:43
Co-authored-by: Hannah Baumann <43765638+hannahbaumann@users.noreply.github.com>

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

Thanks @IAlibay , lgtm!

@IAlibay
IAlibay merged commit 6f6402f into main Jun 12, 2026
11 checks passed
@IAlibay
IAlibay deleted the fix-disconnected branch June 12, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants