Expand description
petgraph-gen is a crate that extends petgraph
with functions that generate graphs with different properties.
Functions§
- barabasi_
albert_ graph - Generates a random graph with
nnodes using the Barabási-Albert model. The process starts with a star graph ofm + 1nodes or an initial graph given by theinitial_graphparameter. Then additional nodes are added one by one. Each new node is connected tomexisting nodes, where the probability of a node being connected to a given node is proportional to the number of edges that node already has. - complete_
graph - Generates a complete graph with
nnodes. A complete graph is a graph where each node is connected to every other node. On a directed graph, this means that each node hasn - 1incoming edges andn - 1outgoing edges. - empty_
graph - Generates an empty graph with
nnodes and no edges. - random_
gnm_ graph - Generates a random graph according to the
G(n,m)Erdős-Rényi model. The resulting graph hasnnodes andmedges are selected randomly and uniformly from the set of all possible edges (excluding loop edges). - random_
gnp_ graph - Generates a random graph according to the
G(n,p)Erdős-Rényi model. The resulting graph hasnnodes and edges are selected with probabilitypfrom the set of all possible edges (excluding loop edges). - star_
graph - Generates a star graph with a single center node connected to
nother nodes. The resulting graph hasn + 1nodes andnedges.