Skip to main content

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 (traditional ll representation) 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 the neato layout 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
  • graphviz
  • networkx
  • pandas

Note: Ensure that the Graphviz system binaries (dot, neato, etc.) are installed on your system path.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_graphviz_plus-0.1.5.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_graphviz_plus-0.1.5-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file python_graphviz_plus-0.1.5.tar.gz.

File metadata

  • Download URL: python_graphviz_plus-0.1.5.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for python_graphviz_plus-0.1.5.tar.gz
Algorithm Hash digest
SHA256 31f0077f087febac86cd9ba94ad2c63bee5ff20ba646bc8a191692b57686da6c
MD5 3dd13d5c7ca55bdc54e6c8f18d5d8984
BLAKE2b-256 9e53b9ce0caf0b2534b267ffc956e1164a92d0ba315e77e94a400e9dec6eb94c

See more details on using hashes here.

File details

Details for the file python_graphviz_plus-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for python_graphviz_plus-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 05421bd01c1f58db390bc20ac4d71616360cf08e1bf52da4f9e3611bf31ee54b
MD5 4150d1f0217e6d7f89b98242ca6349e9
BLAKE2b-256 cc2dafe549890d0877de90e68c53f930e391ae21375c2f43ec8e1c9237e0e8b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page