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
Release history Release notifications | RSS feed
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.9.tar.gz
(18.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simulation_alg-0.1.9.tar.gz.
File metadata
- Download URL: simulation_alg-0.1.9.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9045eb5155831938c34fe8616066dc2b190415da790760be3afd7dd345ca3859
|
|
| MD5 |
5a2889f3755fd5704143dbf616e925e7
|
|
| BLAKE2b-256 |
bec58543c0704cda9c9232e285eac9b4438ef325137ef3dc37cb728f19d2ece3
|
File details
Details for the file simulation_alg-0.1.9-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: simulation_alg-0.1.9-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 427.4 kB
- Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47e8bd049e5b156903ed918b2171a935ac6ff122d9abbde0a9605221b6e34221
|
|
| MD5 |
61f8f88e80af398a32dfd025be69faf9
|
|
| BLAKE2b-256 |
99475ac71836d575aa9257ffc11398e53d27d3c95c687d2d69b9e45f219faebd
|