![]() |
fpmas 1.6
|
#include <ring_graph_builder.h>
Public Member Functions | |
RingGraphBuilder (std::size_t k, RingType ring_type=CYCLE) | |
std::vector< api::graph::DistributedNode< T > * > | build (api::graph::DistributedNodeBuilder< T > &node_builder, api::graph::LayerId layer, api::graph::DistributedGraph< T > &graph) override |
virtual std::vector< api::graph::DistributedNode< T > * > | build (DistributedNodeBuilder< T > &node_builder, LayerId layer, DistributedGraph< T > &graph)=0 |
Implements an api::graph::DistributedGraphBuilder algorithm to build ring shaped graphs.
The ring can be linked in one direction (LOOP) or in both directions (CYCLE).
The number of closest neighbors to which each node is connected can be controlled with the parameter k
.
N_processes | LOOP, k=1 | LOOP, k=2 | ||
---|---|---|---|---|
1 | ![]() | ![]() | ||
4 | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() |
N_processes | CYCLE, k=1 | CYCLE, k=2 | ||
---|---|---|---|---|
1 | ![]() | ![]() | ||
4 | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() |
|
inline |
RingGraphBuilder constructor.
k | the connected nearest neighbors count of each node in each direction. So, if k=2 in a LOOP, each node has 2 outgoing neighbors. If k=2 in a CYCLE, each node has 2 outgoing neighbors in each direction, so 4 in total. |
ring_type | ring type: CYCLE or LOOP |
|
overridevirtual |
Automatically builds the specified graph according to the current implementation.
Nodes are generated using the specified DistributedNodeBuilder. More precisely, DistributedNodeBuilder::localNodeCount() nodes will be inserted in the graph. Generated nodes can then be linked on the specified layer, according to rules defined by the implemented algorithm.
Notice that the specified graph is not required to be empty.
Contrary to the GraphBuilder, this process is synchronous and should be called from all processes.
node_builder | DistributedNodeBuilder instance used to generate nodes |
layer | layer on which nodes will be linked |
graph | graph in which nodes and edges will be inserted |
Implements fpmas::api::graph::DistributedGraphBuilder< T >.