Skip to main content

使用 GraphViz 渲染 NetworkX 图

项目描述

nxv

PyPI 状态 测试 文件状态 编解码器

使用 GraphViz 渲染 NetworkX 图。

文档

https://nxv.readthedocs.io/

基本用法

import networkx as nx
import nxv

graph = nx.Graph()
graph.add_edge("A", "B")
graph.add_edge("B", "C")
graph.add_edge("C", "D")
graph.add_edge("B", "E")

style = nxv.Style(
    graph={"rankdir": "LR"},
    node=lambda u, d: {"shape": "circle" if u in "AEIOU" else "square"},
    edge=lambda u, v, d: {"style": "dashed", "label": u + v},
)

nxv.render(graph, style)

安装

pip install nxv

发展

该存储库使用 Poetry和 Nox 来管理开发环境和构建。

列出所有 Nox 会话:

python -m nox --list-sessions

运行黑码格式化程序:

python -m nox -rs black

使用 flake8 进行 lint:

python -m nox -rs lint

要运行测试套件:

python -m nox -rs tests

要构建文档:

python -m nox -rs docs

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

nxv-0.1.3.tar.gz (16.2 kB 查看哈希)

已上传 source

内置分布

nxv-0.1.3-py3-none-any.whl (26.2 kB 查看哈希)

已上传 py3