simulation-alg


Namesimulation-alg JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://github.com/RaVincentHuang/simulation
SummaryA Python package for simulation algorithms
upload_time2025-07-10 11:34:17
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python Simulation Package 


**Install** 
```bash
git submodule update --init --recursive
pip install maturin
pip install -r requirements.txt
maturin develop --release
```

**How to use**
```python
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))
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/RaVincentHuang/simulation",
    "name": "simulation-alg",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/10/b1/f4ae4e134ce64be078c93c4170c39f7e5c7c22eadf33a37e0d196a9763c2/simulation_alg-0.1.5.tar.gz",
    "platform": null,
    "description": "# Python Simulation Package \n\n\n**Install** \n```bash\ngit submodule update --init --recursive\npip install maturin\npip install -r requirements.txt\nmaturin develop --release\n```\n\n**How to use**\n```python\nimport networkx as nx\nimport simulation\n\ndef random_graph_gen(n, p, k):\n    G: DiGraph = nx.fast_gnp_random_graph(n, p, directed=True)\n    for node in G.nodes:\n        G.nodes[node]['label'] = random.randint(1, k)\n    return G\n\ndef graph_permutation(g: DiGraph) -> DiGraph:\n    nodes = list(g.nodes)\n    random.shuffle(nodes)\n    mapping = dict(zip(g.nodes, nodes))\n    g_perm = nx.relabel_nodes(g, mapping)\n    return g_perm\n\ndef attr_same(attr1: dict, attr2: dict):\n    label1 = attr1.get(\"label\")\n    label2 = attr2.get(\"label\")\n    return label1 == label2\n\nn, p = ...\ng1 = random_graph_gen(n, p, directed=True)\ng2 = graph_permutation(g1)\nprint(simulation.is_simulation_isomorphic_fn(g1, g2, attr_same))\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python package for simulation algorithms",
    "version": "0.1.5",
    "project_urls": {
        "Homepage": "https://github.com/RaVincentHuang/simulation",
        "Source Code": "https://github.com/RaVincentHuang/simulation"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "823ec39825661fd5f173c69731435a0a9d5fcea3b26364200b09621b5974b988",
                "md5": "b4b578b140787f3601d339041dfce8b4",
                "sha256": "09a1378f2b209710b865ccf88aec7e900218106cd1272909c80601ca1b45112f"
            },
            "downloads": -1,
            "filename": "simulation_alg-0.1.5-cp312-cp312-manylinux_2_34_x86_64.whl",
            "has_sig": false,
            "md5_digest": "b4b578b140787f3601d339041dfce8b4",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.10",
            "size": 384320,
            "upload_time": "2025-07-10T11:34:15",
            "upload_time_iso_8601": "2025-07-10T11:34:15.733894Z",
            "url": "https://files.pythonhosted.org/packages/82/3e/c39825661fd5f173c69731435a0a9d5fcea3b26364200b09621b5974b988/simulation_alg-0.1.5-cp312-cp312-manylinux_2_34_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "10b1f4ae4e134ce64be078c93c4170c39f7e5c7c22eadf33a37e0d196a9763c2",
                "md5": "1da615f66ce304c3a5e39b0e066c180f",
                "sha256": "3bd8a0d1ec62bba302e103cc0fc74c79f4f07c7dde109c0742da1c5b0119049e"
            },
            "downloads": -1,
            "filename": "simulation_alg-0.1.5.tar.gz",
            "has_sig": false,
            "md5_digest": "1da615f66ce304c3a5e39b0e066c180f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 16267,
            "upload_time": "2025-07-10T11:34:17",
            "upload_time_iso_8601": "2025-07-10T11:34:17.798856Z",
            "url": "https://files.pythonhosted.org/packages/10/b1/f4ae4e134ce64be078c93c4170c39f7e5c7c22eadf33a37e0d196a9763c2/simulation_alg-0.1.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-10 11:34:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RaVincentHuang",
    "github_project": "simulation",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "simulation-alg"
}
        
Elapsed time: 0.52507s