Graph and network visualization utilities extending graphviz and networkx
Project description
python-graphviz-plus
A set of graph and network visualization utilities that extend graphviz, networkx, and pandas. Highly optimized for generating clean, elegant, and styled graphs in both Jupyter Notebooks and standard Python scripts.
Github
https://github.com/Santt997/python-graphviz-plus
Key Features
AdjacencyList: Parse edge lists (traditionalllrepresentation) or dictionaries of neighbor tuples. Easily convert these structures into Pandas DataFrames for quick inspection and tabular formatting.BlackNeatoGraph: An elegant Graphviz-based class using theneatolayout engine. Renders beautiful dark-themed networks with circular nodes, custom positioning (pos), overlap prevention, and automatic styling. Provides direct helpers to check graph properties (e.g., maximum/minimum degrees, regularity).ValencyList: A specialized helper class to calculate, analyze, and manage the degrees (valency) of all nodes in a graph. Features handshake lemma validation, regular graph detection, and sorted list exports.
Installation
You can install python-graphviz-plus directly from PyPI:
pip install python-graphviz-plus
Quick Start
1. Generating a Black Neato Graph
from graph import BlackNeatoGraph
# Define an edge list (source, destination)
edges = [
("A", "B"),
("B", "C"),
("C", "A"),
("C", "D")
]
# Position mapping for nodes (optional)
positions = [
("A", "0,0!"),
("B", "1,1!"),
("C", "2,0!"),
("D", "3,-1!")
]
# Create and render the black graph
g = BlackNeatoGraph(ll=edges, lp=positions, name="MyBeautifulGraph")
# Inside a Jupyter Notebook, it will render inline:
# g
# Or save to a file:
g.render("graph_output", format="png", cleanup=True)
2. Inspecting Node Valencies
from graph import ValencyList
# Analyze the valencies from the edge list
valencies = ValencyList(edges)
print("Degrees mapping:", valencies.raw())
print("Is regular graph?", valencies.is_regular())
print("Handshake lemma holds?", valencies.sum_check())
3. Converting to a Tabular Adjacency Matrix / DataFrame
from graph import AdjacencyList
adj = AdjacencyList(edges)
df = adj.to_dataframe()
# Display as pandas DataFrame
print(df)
Requirements
- Python >= 3.8
graphviznetworkxpandas
Note: Ensure that the Graphviz system binaries (dot, neato, etc.) are installed on your system path.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_graphviz_plus-0.1.2.tar.gz.
File metadata
- Download URL: python_graphviz_plus-0.1.2.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3002ef513f3b3b9876658ffa524b5e08f0106a00c2f74ea269bcdaa36dec23d4
|
|
| MD5 |
63152dc78f43b850afd877f8ba505c04
|
|
| BLAKE2b-256 |
5fd4d5c5477c28a257f373993078a2c1ef9b183b58cb779879fa017b7637938c
|
File details
Details for the file python_graphviz_plus-0.1.2-py3-none-any.whl.
File metadata
- Download URL: python_graphviz_plus-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18b6de77cfd754c4f8cdcbe5e17a7c1e1ba3aea7354e5492ea9afd7d577ac299
|
|
| MD5 |
30a7c9b1f474e70a35d7d799eb43e49a
|
|
| BLAKE2b-256 |
00b20dfcc613db8cea2bc0cc0192fd9341f6b6a81784f7b512b9581de8ef7a6c
|