nxpp
Header-only graph utilities on top of Boost Graph Library
Loading...
Searching...
No Matches
generators.hpp File Reference

Graph-construction helpers such as complete, path, and Erdos-Renyi graphs. More...

#include "graph.hpp"
Include dependency graph for generators.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename GraphType = Graph<int>>
GraphType nxpp::complete_graph (size_t n)
 Builds the complete graph on node IDs 0 through n - 1.
 
template<typename GraphType = Graph<int>>
GraphType nxpp::path_graph (size_t n)
 Builds a simple path on node IDs 0 through n - 1.
 
template<typename GraphType = Graph<int>>
GraphType nxpp::erdos_renyi_graph (size_t n, double p, int seed=42)
 Builds an Erdos-Renyi random graph on node IDs 0 through n - 1.
 

Detailed Description

Graph-construction helpers such as complete, path, and Erdos-Renyi graphs.

Function Documentation

◆ complete_graph()

template<typename GraphType = Graph<int>>
GraphType nxpp::complete_graph ( size_t  n)

Builds the complete graph on node IDs 0 through n - 1.

Parameters
nNumber of nodes to generate.
Returns
A graph where every distinct node pair is connected.

References nxpp::complete_graph().

Referenced by nxpp::complete_graph().

◆ erdos_renyi_graph()

template<typename GraphType = Graph<int>>
GraphType nxpp::erdos_renyi_graph ( size_t  n,
double  p,
int  seed = 42 
)

Builds an Erdos-Renyi random graph on node IDs 0 through n - 1.

Parameters
nNumber of nodes to generate.
pProbability of adding each candidate edge.
seedRandom seed used by the internal generator.
Returns
A randomly generated graph of the requested type.

References nxpp::erdos_renyi_graph().

Referenced by nxpp::erdos_renyi_graph().

◆ path_graph()

template<typename GraphType = Graph<int>>
GraphType nxpp::path_graph ( size_t  n)

Builds a simple path on node IDs 0 through n - 1.

Parameters
nNumber of nodes to generate.
Returns
A graph containing the path 0-1-...-(n-1).

References nxpp::path_graph().

Referenced by nxpp::path_graph().