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

#include <uniform_graph_builder.h>

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

Public Member Functions

template<typename Generator_t , typename EdgeDist >
 UniformGraphBuilder (Generator_t &generator, EdgeDist &distribution)
 
template<typename EdgeDist >
 UniformGraphBuilder (EdgeDist &distribution)
 
std::vector< api::graph::DistributedNode< T > * > build (api::graph::NodeBuilder< T > &node_builder, api::graph::LayerId layer, api::graph::DistributedGraph< T > &graph) override
 
virtual std::vector< api::graph::DistributedNode< T > * > build (NodeBuilder< T > &node_builder, LayerId layer, DistributedGraph< T > &graph)=0
 

Detailed Description

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

api::graph::GraphBuilder implementation that can be used to generate random uniform graphs. When links are built, nodes are selected uniformly among all the available built nodes.

Constructor & Destructor Documentation

◆ UniformGraphBuilder() [1/2]

template<typename T >
template<typename Generator_t , typename EdgeDist >
fpmas::graph::UniformGraphBuilder< T >::UniformGraphBuilder ( Generator_t &  generator,
EdgeDist &  distribution 
)
inline

UniformGraphBuilder constructor.

Template Parameters
Generator_trandom generator type (must satisfy UniformRandomBitGenerator)
EdgeDistedge count distribution (must satisfy RandomNumberDistribution)
Parameters
generatorrandom number generator provided to the distribution
distributionrandom distribution that manages edges generation. See build()

◆ UniformGraphBuilder() [2/2]

template<typename T >
template<typename EdgeDist >
fpmas::graph::UniformGraphBuilder< T >::UniformGraphBuilder ( EdgeDist &  distribution)
inline

UniformGraphBuilder constructor.

The RandomGraphBuilder::rd random generator is used. It can be seeded with RandomGraphBuilder::seed() or fpmas::seed().

Template Parameters
EdgeDistedge count distribution (must satisfy RandomNumberDistribution)
Parameters
distributionrandom distribution that manages edges generation. See build()

Member Function Documentation

◆ build()

template<typename T >
std::vector< api::graph::DistributedNode< T > * > fpmas::graph::UniformGraphBuilder< T >::build ( api::graph::NodeBuilder< T > &  node_builder,
api::graph::LayerId  layer,
api::graph::DistributedGraph< T > &  graph 
)
overridevirtual

Builds a graph according to the following algorithm.

  1. api::graph::NodeBuilder::nodeCount() are built in the graph.
  2. The number of outgoing edge of each node is determined by the value returned by distribution(generator).
  3. For each node, a subset of nodes among the nodes built by the algorithm is selected uniformly, of size equal to the previously computed output degree of the node. The node is then linked to each node of the subset, on the specified layer.

Any random distribution can be used to build such a graph. The mean output degree of the graph, K, will by definition be equal to the mean of the specified random distribution.

Parameters
node_builderNodeBuilder 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::GraphBuilder< T >.


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