Skip to main content

Lightweight, easy-to-use, flexible composite data structures

Project description

holden

Version PyPI Latest Release GitHub Latest Release
Status Build Status Development Status Project Stability
Documentation Hosted By
Tools Documentation Linter Dependency Manager Pre-commit CI Editor Settings Repository Template Dependency Maintainer
Compatibility Compatible Python Versions Linux MacOS Windows
Stats PyPI Download Rate (per month) GitHub Stars GitHub Contributors GitHub Issues GitHub Forks

What is holden?

This repository is under heavy construction.

This package is named after the Roci's captain in The Expanse, James Holden, who was adept at furling his brow and recognizing connections. In a similar vein, holden offers users easy-to-use composite data structures without the overhead or complexity of larger graph packages. The included graphs are built for basic workflow design or analysis of conditional relationships. They are not designed for big data network analysis or similar large-scale projects (although nothing prevents you from using them in that manner). Rather, the goal of holden is to provide lightweight, turnkey, extensible composite data structures without all of the stuff you don't need in packages like networkx. holden serves as the base for my chrisjen workflow package (similarly named for a character from The Expanse), but I have made holden available separately for easier integration into other uses.

Why use holden?

Simple

The basic building blocks provided are:

  • Composite: the abstract base class for all types of a composite data structures
  • Graph: subclass of Composite and the base class for all graph data structures
  • Edge: an optional edge class which can be treated as a drop-in tuple replacement or extended for greater functionality
  • Node: an optional vertex class which provides universal hashability and some other convenient functions
  • Forms: a dictionary that automatically stores all direct Compisite subclasses to allow flexible subtype checking of and transformation between composite subtypes using its classify and transform methods

Out of the box, Graph has several subtypes with varying internal storage formats:

  • Adjacency: an adjacency list using a dict(Node, set(Node)) structure
  • Matrix: an adjacency matrix that uses a list[list[float | int]] for mapping edges and a separate list[str] attribute that corresponds to the list of lists matrix
  • Edges: an edge list structure that uses a list[tuple[Node, Node]] format

You can use holden without any regard to what is going on inside the graph. The methods and properties are the same regardless of which internal format is used. But the different forms are provided in case you want to utilize the advantages or avoid certain drawbacks of a particular form. Unless you want to design a different graph form, you should design subclasses to inherit from one of the included forms and add mixins to expand functionality.

Flexible

Various traits can be added to graphs, nodes, and edges as mixins including:

  • Weighted edges (Weighted)
  • Abilty to create a graph from or convert any graph to any recognized form using properties with consistent syntax (Fungible)
  • Directed graphs (Directed)
  • Automatically names objects if a name is not passed (Labeled)
  • Has methods to convert and export to other graph formats (Exportable)
  • Ability to store node data internally for easy reuse separate from the graph structure (Storage)

holden provides transformation methods between all of the internal storage forms as well as functions to convert graphs into a set of paths (Parallel) or a single path (Serial). The transformation methods can be used as class properties or with functions using an easy-to-understand naming convention (e.g., adjacency_to_edges or edges_to_parallel).

holden's framework supports a wide range of coding styles. You can create complex multiple inheritance structures with mixins galore or simpler, compositional objects. Even though the data structures are necessarily object-oriented, all of the tools to modify them are also available as functions, for those who prefer a more functional approaching to programming.

The package also uses structural subtyping that allows raw forms of the supported composite subtypes to be used and recognized as the same forms for which holden includes classes. So, for example, the is_adjacency function will recognize any object with a dict(Node, set(Node)) structure and isinstance(item, holden.Adjacency) will similarly return True for a raw adjacency list.

Getting started

Requirements

[TODO: List any OS or other restrictions and pre-installation dependencies]

Installation

To install holden, use pip:

pip install holden

Usage

[TODO: Describe common use cases, with possible example(s)]

Contributing

Contributors are always welcome. Feel free to grab an issue to work on or make a suggested improvement. If you wish to contribute, please read the Contribution Guide and Code of Conduct.

Similar Projects

  • networkx: the market leader for python graphs. Offers greater flexibility and extensibility at the cost of substantial overhead.

Acknowledgments

[TODO: Mention any people or organizations that warrant a special acknowledgment]

License

Use of this repository is authorized under the Apache Software License 2.0.

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

holden-0.1.9.tar.gz (35.0 kB view details)

Uploaded Source

Built Distribution

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

holden-0.1.9-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

Details for the file holden-0.1.9.tar.gz.

File metadata

  • Download URL: holden-0.1.9.tar.gz
  • Upload date:
  • Size: 35.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.22.3 CPython/3.13.2 Linux/6.8.0-1021-azure

File hashes

Hashes for holden-0.1.9.tar.gz
Algorithm Hash digest
SHA256 1e22838dce6c88696c6d9cb837d2030a5da1201ff0b5f8a793f2d3faf8fccc9e
MD5 98b074503f223bb7875d7cecde4eeb89
BLAKE2b-256 8305cac4116fba59e7dd05160dff274937bf2bae82b078f875eaf3773e5d4c8c

See more details on using hashes here.

File details

Details for the file holden-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: holden-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 35.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.22.3 CPython/3.13.2 Linux/6.8.0-1021-azure

File hashes

Hashes for holden-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 75ba82c1b5fdff81c0dfe629a2e7fc6b2b9a36ab9ed2790bf29ff36ebf387169
MD5 6ddaa93425f9c08337dc6d44ba6a13df
BLAKE2b-256 b952e004482983e288537ccc5090791ab21a8b4be28c4ee1092ad352cffeb61c

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