Skip to content

Add hyper_wiener_index function - #8184

Merged
dschult merged 3 commits into
networkx:mainfrom
ilvallod:feat/hyper-wiener-index-8182
Aug 28, 2025
Merged

dschult merged 3 commits into
networkx:mainfrom
ilvallod:feat/hyper-wiener-index-8182

Conversation

@ilvallod

@ilvallod ilvallod commented Aug 7, 2025

Copy link
Copy Markdown
Contributor

This commit introduces the hyper_wiener_index.
The function is added to networkx/algorithms/wiener.py for consistency with related indices. It is defined for simple, connected, undirected graphs and handles edge weights.

Comprehensive unit tests are included, covering correctness for standard graphs (path, cycle, complete), error handling for unsupported graph types, and behavior with trivial graphs and weighted edges.

Closes #8182

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

I'm personally dubious of the value of all these named indices, especially when they boil down to one-liners like this. That said there are already several other "generalizations" so there's precedent for adding more.

Comment thread networkx/algorithms/wiener.py Resolved
Comment thread networkx/algorithms/wiener.py Resolved
This commit introduces the `hyper_wiener_index`.
The function is added to `networkx/algorithms/wiener.py` for
consistency with related indices. It is defined for simple, connected, undirected graphs and handles edge weights.

Comprehensive unit tests are included, covering correctness for standard
graphs (path, cycle, complete), error handling for unsupported graph types,
and behavior with trivial graphs and weighted edges.

Closes networkx#8182
@ilvallod
ilvallod force-pushed the feat/hyper-wiener-index-8182 branch from 57dfe18 to 83ba216 Compare August 13, 2025 14:42
@ilvallod

Copy link
Copy Markdown
Contributor Author

Thanks @rossbar for the feedback! I've made the changes you suggested. Is there anything else we need?

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

I took the liberty of pushing up a few minor doc formatting bits but other than that LGTM, thanks @ilvallod

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

@dschult
dschult merged commit cbc117d into networkx:main Aug 28, 2025
@jarrodmillman jarrodmillman added this to the 3.6 milestone Aug 28, 2025
alfred-mikhael pushed a commit to alfred-mikhael/networkx that referenced this pull request Sep 3, 2025
* Add hyper_wiener_index function

This commit introduces the `hyper_wiener_index`.
The function is added to `networkx/algorithms/wiener.py` for
consistency with related indices. It is defined for simple, connected, undirected graphs and handles edge weights.

Comprehensive unit tests are included, covering correctness for standard
graphs (path, cycle, complete), error handling for unsupported graph types,
and behavior with trivial graphs and weighted edges.

Closes networkx#8182

* Trigger CI

* Formatting nits and add to reference docs.

---------

Co-authored-by: Ross Barnowski <[email protected]>
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.

ENH: Add function for Hyper-Wiener Index

4 participants