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.8.tar.gz (17.8 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.8-cp312-cp312-manylinux_2_34_x86_64.whl (400.2 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

File details

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

File metadata

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

File hashes

Hashes for simulation_alg-0.1.8.tar.gz
Algorithm Hash digest
SHA256 2d3f9c648e06c1eed14b1b1e8aef84fd8cc16d142e13546359ecbfe3909c158b
MD5 ba9d061d7d0a0481b738932b33163f50
BLAKE2b-256 173d69fb20c9db9cf5742ef62ab76ee1350214219d810e0846ff6e6c69364ce0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simulation_alg-0.1.8-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 13cd4b3aa94fd635941ee02bc46eeeb6bf0e5a82d061657390c3a923abd6d26f
MD5 9bf24c8588db983b8e3ea976e5d1c1d3
BLAKE2b-256 2d8f0b49924b7c11c4acf23ff5e73d0323e96eace769315578f437f1b7f4f461

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