Skip to main content

pygraphs

Description

pygraphs provides tools to perform BFS, DFS, Dijkstra, and more on graphs. The package support weighted graphs, directed graphs but not multigraphs.

Authors

Installation

Install with pip

pip install pygraphs
pip install git+https://github.com/Artezaru/pygraphs.git

Clone with git

git clone https://github.com/Artezaru/pygraphs.git

Usage

This section will guide you through the basic usage of the pygraphs package. Several examples are available on the online documentation.

Construct a graph

To create a graph, you can provide the edges or the adjacency :

from pygraphs import Graph

graph = [[1, 2], [0, 2], [0, 1, 3], [2, 4], [3], [6], [5]]
undirected_graph = Graph.from_adjacency(graph)

Perform operations on graphs

Several algorithms are availables to perform basic operations on graphs. For example, the following compute the adjacency matrix by BFS:

from pygraphs import bfs_matrix

adjacency_matrix = bfs_matrix(undirected_graph)
print(f"adjacency_matrix (shape={len(adjacency_matrix)}x{len(adjacency_matrix[0])}):")
print(adjacency_matrix)

# Expected output:
# adjacency_matrix (shape=(7x7)):
# [[ 0  1  1  2  3 -1 -1]
#  [ 1  0  1  2  3 -1 -1]
#  [ 1  1  0  1  2 -1 -1]
#  [ 2  2  1  0  1 -1 -1]
#  [ 3  3  2  1  0 -1 -1]
#  [-1 -1 -1 -1 -1  0  1]
#  [-1 -1 -1 -1 -1  1  0]]

License

Copyright 2026 Artezaru

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Metadata

Release files for pygraphs-x 0.0.4

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

Source distribution (sdist)

Source distribution for pygraphs-x 0.0.4
File Size Uploaded Provenance Actions
pygraphs_x-0.0.4.tar.gz 281.4 kB Without provenance Details for pygraphs_x-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pygraphs-x 0.0.4
File Interpreter ABI Platform Actions
pygraphs_x-0.0.4-py3-none-any.whl Python 3 none any Details for pygraphs_x-0.0.4-py3-none-any.whl

Total release size: 349.7 kB

Release files / pygraphs_x-0.0.4.tar.gz

Download URL pygraphs_x-0.0.4.tar.gz
Size 281.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9564b3367e8ec8c85cce35c9f2f5440ae85ffedf75ad0e715f0b64246d6338dd
BLAKE2b-256 checksum
How to use checksums
a7843dcf9fcfd2c4b9f02b5305cc21052b03c26d647b1f642b8c1e9262f50505
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / pygraphs_x-0.0.4-py3-none-any.whl

Download URL pygraphs_x-0.0.4-py3-none-any.whl
Size 68.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e34cf732c72f6b3906b04d624bce22984f7040e209d66aa9a4b547b676dd280
BLAKE2b-256 checksum
How to use checksums
4e3d306738833e425dae5983b0cb54d86caf2f25e306270990e3d58977c023f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for pygraphs-x 0.0.4

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.

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files No provenance

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