Skip to Content
Hands-On Software Engineering with Golang
book

Hands-On Software Engineering with Golang

by Achilleas Anagnostopoulos
January 2020
Intermediate to advanced
640 pages
16h 56m
English
Packt Publishing
Content preview from Hands-On Software Engineering with Golang

Implementing graph-based algorithms using compute functions

In order for a compute function to be used with the bspgraph package, it must adhere to the following signature:

type ComputeFunc func(g *Graph, v *Vertex, msgIt message.Iterator) error

The first argument to the compute function is a pointer to the Graph instance itself. This allows compute functions to use the graph API to query the current super-step number, look up aggregators, and send messages to vertices. The second argument is a pointer to the Vertex instance that the compute function is operating on, while the third and final argument is a message.Iterator for consuming the messages that were sent to the vertex during the previous super-step.

It is important to note that ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Software Architecture with Golang

Hands-On Software Architecture with Golang

Jyotiswarup Raiturkar

Publisher Resources

ISBN: 9781838554491Supplemental Content