Browse Source

Update 'README.md'

天问 2 years ago
parent
commit
02c853a2df
1 changed files with 32 additions and 0 deletions
  1. 32 0
      README.md

+ 32 - 0
README.md

@@ -1,2 +1,34 @@
+
 # pygraphviz
 
+
+'''
+pip install pygraphviz
+
+
+
+import pygraphviz as pgv
+
+G = pgv.AGraph(directed=True, strict=False, nodesep=0, ranksep=1.2, rankdir="TB",
+           splines="none", concentrate=True, bgcolor="write",
+           compound=True, normalize=False, encoding='UTF-8')
+
+G.add_node(name, label=None, fontname="Times-Roman", fontsize=14,
+       shape="ellipse", style="rounded", color="black", fontcolor="black",
+       pos="x,y(!)", fixedsize=False, width=1, height=1)
+
+G.add_nodes_from(names, **attr) # 批量添加点,参数同上 
+
+
+G.add_edge(origin, target, color="black", style="solid", penwidth=1,
+           label="", fontname="Times-Roman", fontsize=14, fontcolor="black",
+           arrowsize=1, arrowhead="normal", arrowtail="normal", dir="forward")
+
+G.add_nodes_from([[origin_1, target_1],
+                  [origin_2, target_2],...], **attr)  # 批量添加线,参数同上
+
+G.layout()
+G.draw(file_name, prog="neato")
+'''
+
+![](https://pic2.zhimg.com/80/v2-16cb830982e85989b8b8a53ba8e7e7e9_720w.webp)