#graph #random #model #generate #gen #erdos-renyi

bin+lib graph_gen

基于 Erdos-Renyi G(n,p) 模型生成伪随机图

2 个版本

0.1.2 2020 年 4 月 2 日
0.1.1 2020 年 4 月 2 日
0.1.0 2020 年 4 月 2 日

#1782 in 数学

MIT 许可证

17KB
294

Graph Gen

Graph Gen 是一个便捷的工具(和库 crate),它允许您根据 Erdos-Renyi G(n,p) 模型生成伪随机图。

此工具主要设计为简单且速度合理。其目的是为了我在我的研究实验中使用随机输入图。如果您喜欢它并且/或发现它有用,那就更好了。

选项

Graph Gen 提供了几个选项

  • 它允许您构建允许/不允许自环的图(使用 -l 标志)
  • 它允许您构建有向图,如果您需要的话(使用 --d 标志)
  • 它允许您生成随机加权 max2sat 实例(使用 --m 标志)
  • 它允许您指定可用于图边随机标签的权重(使用 --w 选项)。
  • 它允许您以 DIMACS 或 GraphViz 格式输出您的图。

所有必要的信息都应该在内置的帮助中可用。

帮助

graph_gen 0.1.2
Convenience tool to generate pseudo random graphs

USAGE:
    graph_gen [FLAGS] [OPTIONS] --nb_vertices <nb_vertices> --probability <probability>

FLAGS:
    -d, --digraph    If set, the generated graph will be a digraph
    -h, --help       Prints help information
    -l, --loops      If set, self loops are allowed in the generated graph
    -m, --max2sat    If set, the generated graph will be a max2sat instance
    -V, --version    Prints version information

OPTIONS:
    -n, --nb_vertices <nb_vertices>    The number of vertices in the generated graph
    -o, --output <output>              The output language (defaults to dimacs)
    -p, --probability <probability>    The likelihood of any edge to be picked
    -w, --weights <weights>...         Optional weight candidates

构建

Graph Gen 是用 Rust 编写的。因此,它使用 cargo 工具进行编译。所以 cargo build --release 将在 target 文件夹中生成发布二进制文件。

依赖项

~3.5MB
~60K SLoC