Skip to main content

kcol_graph_gen

alt text A minimalistic python package to generate a k-colorable graph.

Installation

Just run pip install kcol-graph-gen and you are good to go!

Usage

Before generating the graph you have to make an object of the class KColorableGraphGenerator. You can specify an optional seed for the default random package which is used during the generation of the graph.

Once the object is crated, you can use generate method to generate the graphs. This takes three arguments n : number of vertices, k : specifying the number of colors, p(optional, default=0.5) : Probability with which any edge is added into the graph. Higher the value of p denser the resulting graph will be.

Below is the code snippet which demonstrates the usage:

from kcol_graph_gen import KColorableGraphGenerator

generator = KColorableGraphGenerator(seed=42)
edges = generator.generate(4, 2, 0.3)  # Create a bipartite graph

print(edges)  # Printing the list of edges
# > [(2, 3), (2, 4), (1, 2)]

edges = generator.generate(
    6, 3, 0.9
)  # Create a 3-colorable dense graph with 6 vertices

print(edges)  # Printing the list of edges
# > [(2, 4), (1, 2), (3, 4), (1, 5), (2, 3), (4, 5), (2, 6), (5, 6), (3, 6), (2, 5), (1, 3)]

Metadata

Release files for kcol-graph-gen 1.0.0

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

Source distribution (sdist)

Source distribution for kcol-graph-gen 1.0.0
File Size Uploaded
kcol-graph-gen-1.0.0.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kcol-graph-gen 1.0.0
File Interpreter ABI Platform
kcol_graph_gen-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / kcol-graph-gen-1.0.0.tar.gz

Download URL kcol-graph-gen-1.0.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7b6738940bcb5ca782d6b67af9b9304b7d61f98d9da3d982d08e5f6856c40240
BLAKE2b-256 checksum
How to use checksums
c00588a064be6f2b44b4caa37e0901526c64d269486f004fdc03fa2c671740bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.5

Release files / kcol_graph_gen-1.0.0-py3-none-any.whl

Download URL kcol_graph_gen-1.0.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
14ba8b089323c8801a7998547b44883ba705eaae8fe6959c1ea30ee1b47a3869
BLAKE2b-256 checksum
How to use checksums
7b90d6b5d36c9f2165a980ee9912e4e59181235936c0be2794e7fa32132f21f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 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