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.14.tar.gz (20.0 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.14-cp312-cp312-manylinux_2_34_x86_64.whl (444.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

File details

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

File metadata

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

File hashes

Hashes for simulation_alg-0.1.14.tar.gz
Algorithm Hash digest
SHA256 c78d45555dfd027db88d2b828dbaf6b0b838d00de5067f4b91636db5b6251eb2
MD5 e1e928a2e915534e2920af5d0a2abf0a
BLAKE2b-256 29bea22756baa30ff8bd34230c4c957d8f1374393a497917362f5026e7ce5e6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simulation_alg-0.1.14-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 21f2d118c2d2015665c9c5738ff8ba8fc9bb226dbc641a4f4b1c2d95989895c3
MD5 60789a0fc4f92979f6d1cc3ab2487c60
BLAKE2b-256 7742022715d6b23fd69bf8307be63427da9db4893acb624e0ecc61922f7ee54a

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