fpmas 1.6
Public Member Functions | List of all members
fpmas::graph::RingGraphBuilder< T > Class Template Reference

#include <ring_graph_builder.h>

Inheritance diagram for fpmas::graph::RingGraphBuilder< T >:
Inheritance graph
[legend]
Collaboration diagram for fpmas::graph::RingGraphBuilder< T >:
Collaboration graph
[legend]

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
 

Detailed Description

template<typename T>
class fpmas::graph::RingGraphBuilder< T >

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.

Examples

N_processes LOOP, k=1 LOOP, k=2
1
4
N_processes CYCLE, k=1 CYCLE, k=2
1
4

Constructor & Destructor Documentation

◆ RingGraphBuilder()

template<typename T >
fpmas::graph::RingGraphBuilder< T >::RingGraphBuilder ( std::size_t  k,
RingType  ring_type = CYCLE 
)
inline

RingGraphBuilder constructor.

Parameters
kthe 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_typering type: CYCLE or LOOP

Member Function Documentation

◆ build()

template<typename T >
std::vector< api::graph::DistributedNode< T > * > fpmas::graph::RingGraphBuilder< T >::build ( api::graph::DistributedNodeBuilder< T > &  node_builder,
api::graph::LayerId  layer,
api::graph::DistributedGraph< T > &  graph 
)
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.

Parameters
node_builderDistributedNodeBuilder instance used to generate nodes
layerlayer on which nodes will be linked
graphgraph in which nodes and edges will be inserted
Returns
built nodes

Implements fpmas::api::graph::DistributedGraphBuilder< T >.


The documentation for this class was generated from the following file: