January 2020
Intermediate to advanced
640 pages
16h 56m
English
The Vertex type encapsulates the state of each vertex that is part of a Graph instance:
type Vertex struct { id string value interface{} active bool msgQueue [2]message.Queue edges []*Edge }
An interesting tidbit about the Vertex type definition is that we actually need to maintain two message.Queue instances. Any messages produced by compute function invocations while executing a super-step must be buffered so that they can be delivered to the intended recipient in the following super-step. To this end, our implementation will employ a double-buffering scheme. We will use one queue to hold the messages for the current super-step and another queue to buffer the messages for the next super-step. At the end ...