# Crate petgraph_gen

source ·## Expand description

`petgraph-gen`

is a crate that extends petgraph
with functions that generate graphs with different properties.

## Functions

Generates a random graph with

`n`

nodes using the Barabási-Albert model. The process
starts with a star graph of `m + 1`

nodes or an initial graph given by the `initial_graph`

parameter. Then additional nodes are added one by one.
Each new node is connected to `m`

existing nodes, where the probability of a node
being connected to a given node is proportional to the number of edges that node already has.Generates a complete graph with

`n`

nodes. A complete graph is a graph where
each node is connected to every other node. On a directed graph, this means
that each node has `n - 1`

incoming edges and `n - 1`

outgoing edges.Generates an empty graph with

`n`

nodes and no edges.Generates a random graph according to the

`G(n,m)`

Erdős-Rényi model. The resulting graph has `n`

nodes and `m`

edges are selected randomly and uniformly from the set of all possible edges
(excluding loop edges).Generates a random graph according to the

`G(n,p)`

Erdős-Rényi model.
The resulting graph has `n`

nodes and edges are selected with probability `p`

from the set
of all possible edges (excluding loop edges).Generates a star graph with a single center node connected to

`n`

other nodes. The resulting
graph has `n + 1`

nodes and `n`

edges.