Skip to content

Clarify in docs that monoids are commutative and associative #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 28, 2023

Conversation

eriknw
Copy link
Member

@eriknw eriknw commented Jun 23, 2023

Technically Monoids don't need to commute, but behavior is ill-defined (or invalid) if non-commutative monoids are used for reductions and semirings, so, practically speaking, all monoids should commute in GraphBLAS. I don't know of any use cases for non-commutative monoids--a binary operator should always be possible to use and preferred.

Fixes #468.

@coveralls
Copy link

coveralls commented Jun 23, 2023

Coverage Status

coverage: 99.55% (+11.6%) from 87.908% when pulling 1155676 on eriknw:monoids_commute_and_associate into da01661 on python-graphblas:main.

Copy link
Member

@SultanOrazbayev SultanOrazbayev left a comment

Choose a reason for hiding this comment

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

Looks good, with a possible clarification that GraphBLAS uses commutative monoids (so commutative is not part of the definition of a monoid, but the monoids used by GraphBLAS also have this property). That's my understanding from the "Design of the GraphBLAS API for C" paper and, ahem, Wikipedia.

@eriknw
Copy link
Member Author

eriknw commented Jun 28, 2023

Thanks for looking @SultanOrazbayev. Refined.

Copy link
Member

@SultanOrazbayev SultanOrazbayev left a comment

Choose a reason for hiding this comment

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

Thank you, LGTM!

@eriknw eriknw merged commit 5e18a9c into python-graphblas:main Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improve or add to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[pyos][docs] "Monoids are also associative, so the order of the inputs does not matter."
3 participants