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.2.tar.gz
(16.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.2.tar.gz.
File metadata
- Download URL: simulation_alg-0.1.2.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b296009b6bd79455ae32d6d3ce5bd4af684d367b5d198450e51461d2b3d3e51c
|
|
| MD5 |
f0cd9b4c2411ac0de50bd7d4854b04a1
|
|
| BLAKE2b-256 |
cafea513f07189b911556de733ebad3b408ba099122b8f8af0aead945dd727a4
|
File details
Details for the file simulation_alg-0.1.2-cp310-cp310-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: simulation_alg-0.1.2-cp310-cp310-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 446.5 kB
- Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d6f955c7694b5e54b54659c3b2577f4089962b42b81df95c19c343790692716
|
|
| MD5 |
806978e8e8ca8a067abadb73bd5ccc48
|
|
| BLAKE2b-256 |
bf5347f80fd3865603c570ce231e590df11033bc28dca9c56bce7b44b0f01369
|