Skip to main content

Project generated with PyScaffold Documentation Status codecov

🥅 netlistx

Netlist and its related Algorithms in Python

This library defines a set of classes and functions for working with netlists, which are representations of electronic circuits. The main purpose of this library is to provide tools for creating, manipulating, and analyzing netlists.

The library doesn't take any direct inputs or produce any outputs on its own. Instead, it defines classes and functions that can be used by other parts of a program to work with netlists.

The main class in this library is the Netlist class. It represents a netlist as a graph, where modules (like electronic components) are connected by nets (like wires). The Netlist class takes three inputs when created: a graph representing the connections, a list of modules, and a list of nets.

The Netlist class provides several methods to get information about the netlist, such as the number of modules, nets, nodes, and pins. It also allows you to get the weight of modules and nets, which could represent things like the size or importance of components in the circuit.

The library includes several helper functions to create specific types of netlists. For example, create_inverter() creates a netlist representing a simple inverter circuit, while create_random_hgraph() creates a random netlist with a specified number of modules and nets.

The library uses graph theory concepts to represent the netlist. It uses the NetworkX library to handle the graph operations. The graph is represented as nodes (modules and nets) connected by edges (connections between modules and nets).

One important aspect of the library is how it handles the weights of modules and nets. It uses a RepeatArray class (which is not defined in this file) to efficiently store weights when many components have the same weight.

This library also implements several algorithms for solving different types of graph problems in graphs. The main purpose is to find minimal sets of vertices or edges that "cover" certain structures in a graph, such as all edges, cycles, or odd cycles.

The library takes various inputs depending on the specific function being used. Generally, it requires a graph structure (either a regular graph or a hypergraph), a weight mapping for the vertices, and sometimes an optional initial set. The graphs are typically represented using the NetworkX library (nx.Graph).

The outputs produced by these functions are usually a tuple containing two elements: a set representing the minimal cover found, and a number representing the total weight or cost of that cover.

The library achieves its purpose through several different algorithms, but they all follow a similar pattern called the primal-dual approximation method. This method iteratively builds a solution by selecting elements that violate certain conditions and adding them to the cover set.

The library uses several important data structures and algorithms. Graphs are represented using NetworkX, which provides efficient graph operations. The algorithms make heavy use of sets for storing covers and dictionaries for storing weights and other information. The cycle-finding algorithms use breadth-first search and clever bookkeeping to efficiently detect cycles in the graph.

The library also includes functions for reading netlists from JSON files and for creating specific test netlists. These functions could be useful for testing or demonstrating the capabilities of the Netlist class.

Overall, this library provides a foundation for working with netlists in Python. It allows programmers to create, manipulate, and analyze netlists, which could be useful in electronic design automation tools or circuit analysis software.

Installation

pip install netlistx

Python 3.11+ is required. Optional GPU acceleration (Numba CUDA):

pip install netlistx[gpu]

Quickstart

import networkx as nx

from netlistx.cover import min_vertex_cover
from netlistx.netlist import create_inverter

netlist = create_inverter()
print(netlist.number_of_modules(), netlist.number_of_nets())

graph = nx.Graph([(0, 1), (1, 2), (2, 0)])
cover, cost = min_vertex_cover(graph, {0: 1, 1: 1, 2: 1})
print(cover, cost)

Dependencies

Optional extras: netlistx[gpu] adds numba + numpy; netlistx[examples] adds numpy, jsonschema, and liberty-parser for the scripts under examples/.

Repository layout

  • src/netlistx/ — library code
  • tests/ — pytest suite (including Hypothesis property tests)
  • benches/ — pytest-benchmark performance benchmarks
  • examples/yosys/ — Yosys/Liberty tutorials and sample data
  • experiments/ — exploratory demos
  • scripts/ — developer utilities
  • docs/ — Sphinx documentation and design notes (docs/notes/)

See also

Used by

License

MIT — see LICENSE.txt.

Metadata

Release files for netlistx 0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for netlistx 0.8
File Size Uploaded Provenance Actions
netlistx-0.8.tar.gz 1.6 MB With provenance Details for netlistx-0.8.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for netlistx 0.8
File Interpreter ABI Platform Actions
netlistx-0.8-py3-none-any.whl Python 3 none any Details for netlistx-0.8-py3-none-any.whl

Total release size: 1.6 MB

Release files / netlistx-0.8.tar.gz

Download URL netlistx-0.8.tar.gz
Size 1.6 MB
Tags Source
SHA-256 checksum
How to use checksums
52d81d7f79fac6410b099403a1c702f23915501996c65d3d92eef7abc25eefc6
BLAKE2b-256 checksum
How to use checksums
03f9170d7c06defedf01c54113c8a352364ac202c1aa8f85ea4121dcbfde6198
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / netlistx-0.8-py3-none-any.whl

Download URL netlistx-0.8-py3-none-any.whl
Size 38.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14d3b151a3c6b81307639af07afae67c7fd7243ce2bf21b596ca1b5af8e1e149
BLAKE2b-256 checksum
How to use checksums
0184405900fac4f4f58df3f95384b9af68b5cf8f3fef49ae5844727c5a395346
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for netlistx 0.8

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for netlistx-0.8.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page