Pygraphv
Pygraphv - python library for generating dot programming language for creating graphviz graphs from python OO style code.
Examples
Basic graph:
from pygraphv.graph import Graph
from pygraphv.node import Node
from pygraphv.style import GraphStyle
# Chose one of this
# You can look at difference in Graphviz docs
# digraph = Digraph("Digraph")
graph = Graph("Graph")
# Adds node with name A, that has child node B
a = Node("A")
graph.add_node(a)
graph.add_node(Node("B"), parent=a)
# Generates .dot file for your graph and saves it in "Your first graph.dot"
# And renders it to svg file, needs dot compiler installed and added to path
graph.render("Your first graph")
Styles:
from pygraphv.graph import Digraph
from pygraphv.style import *
from pygraphv.node import Node
# Now digraph example
# Only difference to regular graph is arrows at ends of connections
graph = Digraph("Graph", styles=[GraphStyle(bgcolor="lightblue"), GraphStyle(href="github.com/farkon00")])
# Adds node with name A, that has child node B
a = Node("A", styles=NodeStyle(color="red", shape="box"))
graph.add_node(a)
graph.add_node(Node("B"), label="Styled edge", parent=a, styles=EdgeStyle(arrowhead="box"))
# Generates .dot file for your graph and saves it in "Styles.dot"
# And renders it to svg file, needs dot compiler installed and added to path
graph.render("Styles")
Clusters:
from pygraphv.graph import Graph, Cluster
from pygraphv.style import *
from pygraphv.node import Node
graph = Graph("Graph")
# Adds node with name A, that has child node B
a = Node("A")
graph.add_node(a)
graph.add_node(Node("B"), parent=a)
# Creates cluster and adds cycle of 3 nodes, connected to node A
# Can be compressed to one style object
# But you can use GraphStyle on clusters
cluster = Cluster("Cluster", styles=(GraphStyle(bgcolor="lightgreen"), ClusterStyle(style="dotted")))
node1 = Node("1")
cluster.add_node(node1)
a.children.append(node1)
cluster.add_node(Node("2"), parent=node1)
cluster.add_node(Node("3"), parent=node1)
graph.add_node(node1.children[-1].node, parent=node1.children[-2].node)
graph.add_subgraph(cluster)
# Generates .dot file for your graph and saves it in "Clusters.dot"
# And renders it to svg file, needs dot compiler installed and added to path
graph.render("Clusters")
Metadata
Release files for pygraphv 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pygraphv-0.2.1.tar.gz | 7.3 kB | Without provenance | Details for pygraphv-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pygraphv-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for pygraphv-0.2.1-py3-none-any.whl |
Total release size: 14.8 kB
Release files / pygraphv-0.2.1.tar.gz
| Download URL | pygraphv-0.2.1.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6df53a6f8745f1b3c3eea66b391a6c7198f903cb2146996d12ed9437715ea1de
|
|
BLAKE2b-256 checksum How to use checksums |
9f086369bfe074d80b1ca8009d5ab28c7ec2c5aa4ce487336dac968ad280b9b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Release files / pygraphv-0.2.1-py3-none-any.whl
| Download URL | pygraphv-0.2.1-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b163871eb811fe352cc7589474f488993b96a5fa9c844c2df7e555732fa7622
|
|
BLAKE2b-256 checksum How to use checksums |
d07317b6f4a60fce361ae331dfa3277c12447f258c95dec9428d69e44164e651
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.4
|
Security for pygraphv 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.