Skip to content

Instantly share code, notes, and snippets.

@michelp
Last active August 19, 2019 15:23
Show Gist options
  • Save michelp/d1a6b0c86a539d9ab4fc63a125df23b0 to your computer and use it in GitHub Desktop.
Save michelp/d1a6b0c86a539d9ab4fc63a125df23b0 to your computer and use it in GitHub Desktop.
from pygraphblas import Type, Monoid, Semiring, binary_op
class BF_Tuple3(Type):
identity = (float('inf'), # sum of edge lengths
UINT64_MAX, # parent of ith vertex
UINT64_MAX) # number of edges from s to i
@binary_op
def min(self, other):
...
@binary_op
def plus(self, other):
...
min_monoid = Monoid(min, identity)
min_plus = Semiring(min_monoid, plus)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment