Skip to main content

A Python package for simulation algorithms

Project description

Python Simulation Package

Install

git submodule update --init --recursive
pip install maturin
pip install -r requirements.txt
maturin develop --release

How to use

import networkx as nx
import simulation

def random_graph_gen(n, p, k):
    G: DiGraph = nx.fast_gnp_random_graph(n, p, directed=True)
    for node in G.nodes:
        G.nodes[node]['label'] = random.randint(1, k)
    return G

def graph_permutation(g: DiGraph) -> DiGraph:
    nodes = list(g.nodes)
    random.shuffle(nodes)
    mapping = dict(zip(g.nodes, nodes))
    g_perm = nx.relabel_nodes(g, mapping)
    return g_perm

def attr_same(attr1: dict, attr2: dict):
    label1 = attr1.get("label")
    label2 = attr2.get("label")
    return label1 == label2

n, p = ...
g1 = random_graph_gen(n, p, directed=True)
g2 = graph_permutation(g1)
print(simulation.is_simulation_isomorphic_fn(g1, g2, attr_same))

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

simulation_alg-0.1.6.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

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

simulation_alg-0.1.6-cp312-cp312-manylinux_2_34_x86_64.whl (399.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

File details

Details for the file simulation_alg-0.1.6.tar.gz.

File metadata

  • Download URL: simulation_alg-0.1.6.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.1

File hashes

Hashes for simulation_alg-0.1.6.tar.gz
Algorithm Hash digest
SHA256 74307abfaa09c6b29a5e246141df723e1db894df178a921b5327bcd7ebcc588e
MD5 880b5dfff973486de10b55a99b1ca1f1
BLAKE2b-256 cf7632e8877c10c8caa60a6504526e3675da43f0c4c9dd23362ed25d429019dd

See more details on using hashes here.

File details

Details for the file simulation_alg-0.1.6-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for simulation_alg-0.1.6-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 8cdd38e34655d12b6949995e420a339bf275f0cdad462a8d1d98e44c83afc219
MD5 4786a819633f68cefa059395d84a2a8c
BLAKE2b-256 ae46f792f36ee9e07825af8c2ac35b1340186b9076f138112d979ef644dbc24f

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