pyintergraph


Namepyintergraph JSON
Version 1.3.3 PyPI version JSON
download
home_pagehttps://github.com/luerhard/pyintergraph
SummaryConvert Python-Graph-Objects between networkx, python-igraph and graph-tools.
upload_time2023-11-23 08:52:24
maintainer
docs_urlNone
authorLukas Erhard
requires_python>=3.8,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyintergraph

Convert Python-Graph-Objects between networkx, python-igraph and graph-tool. 

# Installation 
This package can be installed via:
```
pip install pyintergraph
```
For the note on imports and dependencies, see the section at the bottom of the page. 

# Usage

```python
import networkx as nx
import pyintergraph

nx_graph = nx.karate_club_graph()

graph_tool_graph = pyintergraph.nx2gt(nx_graph, labelname="node_label")
igraph_graph = pyintergraph.gt2igraph(graph_tool_graph, labelname="node_label")
reversed_nx_graph = pyintergraph.igraph2nx(igraph_graph)

# or

Graph = pyintergraph.InterGraph.from_networkx(nx_graph)
graph_tool_graph = Graph.to_graph_tool(labelname="node_label")
igraph_graph = Graph.to_igraph()
reversed_nx_graph = Graph.to_networkx()

assert list(nx_graph.nodes(data=True)) == list(reversed_nx_graph.nodes(data=True))
assert list(nx_graph.edges(data=True)) == list(reversed_nx_graph.edges(data=True))
assert type(nx_graph) == type(reversed_nx_graph)
```

## A note on imports and dependencies

Because the installation of python-igraph and graph_tool can be tricky, they are not set as required dependencies for this package. As not everyone has all three packages installed, imports happen just when the two functions of interest are called. That way it is possible to convert networkX-Graphs to igraph-Graphs even when graph_tool is not installed.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/luerhard/pyintergraph",
    "name": "pyintergraph",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Lukas Erhard",
    "author_email": "luerhard@googlemail.com",
    "download_url": "https://files.pythonhosted.org/packages/a6/e7/788d3652dc44fcaf2f05bee55505f1b4658510abb7346c09042cdd73dc08/pyintergraph-1.3.3.tar.gz",
    "platform": null,
    "description": "# pyintergraph\n\nConvert Python-Graph-Objects between networkx, python-igraph and graph-tool. \n\n# Installation \nThis package can be installed via:\n```\npip install pyintergraph\n```\nFor the note on imports and dependencies, see the section at the bottom of the page. \n\n# Usage\n\n```python\nimport networkx as nx\nimport pyintergraph\n\nnx_graph = nx.karate_club_graph()\n\ngraph_tool_graph = pyintergraph.nx2gt(nx_graph, labelname=\"node_label\")\nigraph_graph = pyintergraph.gt2igraph(graph_tool_graph, labelname=\"node_label\")\nreversed_nx_graph = pyintergraph.igraph2nx(igraph_graph)\n\n# or\n\nGraph = pyintergraph.InterGraph.from_networkx(nx_graph)\ngraph_tool_graph = Graph.to_graph_tool(labelname=\"node_label\")\nigraph_graph = Graph.to_igraph()\nreversed_nx_graph = Graph.to_networkx()\n\nassert list(nx_graph.nodes(data=True)) == list(reversed_nx_graph.nodes(data=True))\nassert list(nx_graph.edges(data=True)) == list(reversed_nx_graph.edges(data=True))\nassert type(nx_graph) == type(reversed_nx_graph)\n```\n\n## A note on imports and dependencies\n\nBecause the installation of python-igraph and graph_tool can be tricky, they are not set as required dependencies for this package. As not everyone has all three packages installed, imports happen just when the two functions of interest are called. That way it is possible to convert networkX-Graphs to igraph-Graphs even when graph_tool is not installed.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Convert Python-Graph-Objects between networkx, python-igraph and graph-tools.",
    "version": "1.3.3",
    "project_urls": {
        "Homepage": "https://github.com/luerhard/pyintergraph",
        "Repository": "https://github.com/luerhard/pyintergraph"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6ba5e69102d4aca2414954e7e04ba8bd858fa66f6b839fd85bc8f0aa4359beb5",
                "md5": "37b9c8a0757bc499427814a08bf8248e",
                "sha256": "15dbdf31659ded9fd0e1ee0155e7e7b8fbeae07b26794ef0bd260b3fdb32e861"
            },
            "downloads": -1,
            "filename": "pyintergraph-1.3.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "37b9c8a0757bc499427814a08bf8248e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 7102,
            "upload_time": "2023-11-23T08:52:23",
            "upload_time_iso_8601": "2023-11-23T08:52:23.164034Z",
            "url": "https://files.pythonhosted.org/packages/6b/a5/e69102d4aca2414954e7e04ba8bd858fa66f6b839fd85bc8f0aa4359beb5/pyintergraph-1.3.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a6e7788d3652dc44fcaf2f05bee55505f1b4658510abb7346c09042cdd73dc08",
                "md5": "5075dcb6446c18ec0cfece27b2064c00",
                "sha256": "2ba5396f497149d3179d400effd8ede5634ca3304ce7458ed350017f1cbe05fc"
            },
            "downloads": -1,
            "filename": "pyintergraph-1.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "5075dcb6446c18ec0cfece27b2064c00",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 5946,
            "upload_time": "2023-11-23T08:52:24",
            "upload_time_iso_8601": "2023-11-23T08:52:24.279198Z",
            "url": "https://files.pythonhosted.org/packages/a6/e7/788d3652dc44fcaf2f05bee55505f1b4658510abb7346c09042cdd73dc08/pyintergraph-1.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-23 08:52:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "luerhard",
    "github_project": "pyintergraph",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyintergraph"
}
        
Elapsed time: 0.51470s