Skip to main content

Cygraph

A graph theory library implemented in Cython

Installation

First, try:

pip install cygraph

if that doesn't work, try:

pip install git+https://github.com/lol-cubes/cygraph

Usage

Python

Here is an example Python script that utilizes some of the features of cygraph.

import cygraph as cg
import cygraph.algorithms as alg

G = cg.graph(vertices=list(range(4)))
G.add_edges({(1, 2), (2, 3), (3, 1)})
children = G.get_children(1)
print(f'{children=}')
components = alg.get_number_connected_components(G)
print(f'{components=}')

It should output:

children={2, 3}
components=2

Cython

Here is the above script but with static typing in Cython.

#!python
#cython: language_level=3
import cygraph as cg  # cg.graph function.
cimport cygraph.graph_ as gp  # StaticGraph and DynamicGraph types.
cimport cygraph.algorithms as alg

cdef gp.DynamicGraph G = cg.graph(vertices=list(range(4)))
G.add_edges({(1, 2), (2, 3), (3, 1)})
cdef set children = G.get_children(1)
print(f'children={str(children)}')
cdef int components = alg.get_number_connected_components(G)
print(f'components={components}')

For more information on the Python and Cython APIs, see the documentation


NOTE

The current documentation is not up-to-date.


Contribution

I am currently not accepting any pull requests. This project is still in its very early stages and I have many things in mind to do with it. Once I get those things done, I will add contribution guidelines.

Metadata

Release files for cygraph 0.2.1

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

Source distribution (sdist)

Source distribution for cygraph 0.2.1
File Size Uploaded
cygraph-0.2.1.tar.gz 743.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cygraph 0.2.1
File Interpreter ABI Platform
cygraph-0.2.1-cp38-cp38-macosx_10_9_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.9+ x86-64 Details

Total release size: 2.1 MB

Release files / cygraph-0.2.1.tar.gz

Download URL cygraph-0.2.1.tar.gz
Size 743.0 kB
Tags Source
SHA-256 checksum
How to use checksums
80ae7a66b78311b7d62e08b9c9fb808413b90314c077b69204c78373e253e56c
BLAKE2b-256 checksum
How to use checksums
76cb49fa757a4b8b111a45748f7bfe04945c359cf4944be7a3f77dcabf139ed7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0

Release files / cygraph-0.2.1-cp38-cp38-macosx_10_9_x86_64.whl

Download URL cygraph-0.2.1-cp38-cp38-macosx_10_9_x86_64.whl
Size 1.3 MB
Tags CPython 3.8 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
0637bd70d961f6cc9e71d6351fc3e80efb1c0e8f6ba2f73dce048138fc4302e2
BLAKE2b-256 checksum
How to use checksums
5b32cfacc67a2697f176ad8d37a14ea291f8561c4a6c1d0e830a6a9ef7299c39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.0

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

3 release files

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