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.1.tar.gz (16.2 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.1-cp310-cp310-manylinux_2_34_x86_64.whl (446.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

File details

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

File metadata

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

File hashes

Hashes for simulation_alg-0.1.1.tar.gz
Algorithm Hash digest
SHA256 13dbddab34a48bbc043a6f9df073a271282bbe2aaed26a8aea3714fcafe49fba
MD5 f7a97ced3e5890bad49efdd4a60b127b
BLAKE2b-256 896ca23b4ec002be8933769e7940e72d7d67fc9db699ccf8fe3707dfb70bfe36

See more details on using hashes here.

File details

Details for the file simulation_alg-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for simulation_alg-0.1.1-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 065c974d5dd0b3604742b54d47ac137beb9a872756c6ad02932a681812c85674
MD5 5e8b9c314e0c1bfba09c099b4efd4777
BLAKE2b-256 643babe417dd7dc692ab3d2fa4d905b92e85bf92af17763ffbb4e2882f08bfaf

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