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.3.tar.gz
(16.3 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.3.tar.gz.
File metadata
- Download URL: simulation_alg-0.1.3.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d49198a19ad2152cd078f2f85571858d8725e9ce4fe8741b64420b3616700358
|
|
| MD5 |
1c74a83083e1aceedff6facc31d01e6c
|
|
| BLAKE2b-256 |
239eafcd690412cb30b3bea37d5a17f5fff969661a695dfd17ddc292ef918219
|
File details
Details for the file simulation_alg-0.1.3-cp312-cp312-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: simulation_alg-0.1.3-cp312-cp312-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 369.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 |
44b00fe34a2f865edaa20780e4306d4d1199f24c5858144ba87650d687e140fc
|
|
| MD5 |
9f981f8675841e66c238635ecb56e932
|
|
| BLAKE2b-256 |
19e4c8b2ebe5064fb97d216ca38269b80f247a6956e23e3f57aea74e3b6dad87
|