配置
igraph 包含可以通过 configuration.Configuration 对象设置的定制选项,并且可以通过配置文件保存。在 Linux 和 Mac OS X 系统上,此文件默认存储在 ~/.igraphrc,在 Windows 系统上,存储在 C:\Documents and Settings\username\.igraphrc。
要修改配置选项并将结果存储到文件中以供将来重复使用:
import igraph as ig
# Set configuration variables
ig.config["plotting.backend"] = "matplotlib"
ig.config["plotting.palette"] = "rainbow"
# Save configuration to default file location
ig.config.save()
一旦你的配置文件存在,igraph 将在导入时自动加载其内容。
可以通过向config.save传递参数来将多个配置文件保存在非标准位置,例如ig.config.save("/path/to/config/file")。要在下次导入igraph时加载特定的配置,请使用:
import igraph as ig
ig.config.load("/path/to/config/file")