graph-express


Namegraph-express JSON
Version 1.0a3 PyPI version JSON
download
home_pagehttps://github.com/nelsonaloysio/graph-express
SummaryPython package for the analysis and visualization of network graphs.
upload_time2024-02-24 02:09:50
maintainer
docs_urlNone
author['Nelson Aloysio Reis de Almeida Passos']
requires_python>=3.6
licenseMIT
keywords network graph
VCS
bugtrack_url
requirements cdlib datashader kaleido leidenalg networkit networkx networkx_gdf openpyxl pandas plotly python-igraph python-louvain
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # graph-express

Python package for the analysis and visualization of network graphs with familiar libraries such as
[NetworkX](https://networkx.org/), [NetworKit](https://networkit.github.io/), [igraph](https://igraph.org/), [cdlib](https://cdlib.readthedocs.io/en/latest/), and [Plotly](https://plotly.com/).

## Requirements

* **Python 3.6.8+**
* cdlib>=0.3.0
* datashader>=0.10.0
* kaleido>=0.2.1
* leidenalg>=0.8.3
* networkit>=7.0
* networkx>=2.3
* networkx-gdf>=1.1
* openpyxl>=3.1.2
* pandas>=0.25.3
* plotly>=3.10.0
* python-igraph>=0.8.3
* python-louvain>=0.14

## Usage

> The following is an overview of the package, to be replaced with guidelines detailing its usage with examples.

### Import high-level class

```python
import graph_express.graph_express as gx
```

#### Read graph from file

Accepted extensions include all formats supported by [networkx](https://networkx.org/documentation/stable/reference/readwrite/index.html) and [networkx-gdf](https://pypi.org/project/networkx-gdf/).

```python
G = gx.read_graph("/path/to/file.ext", ...)
```

#### Compute centrality and communities

Generates a data frame with node centrality values and communities, e.g., using the Leiden algorithm:

```python
df = gx.compute(G, attrs=["degree", "leiden"])
```

#### Plot network graph

Calculates positions and plots the network graph.

```python
fig = gx.draw(G, layout="forceatlas2", renderer="networkx")
```

<!-- For details on implemented layouts and renderers, please see the [documentation](). -->

___

### Import specific classes

This package implements six classes with static methods to allow inheriting their implemented methods:

```python
import graph_express

Centrality = graph_express.Centrality()
Community = graph_express.Community()
Convert = graph_express.Convert()
Draw = graph_express.Draw()
Graph = graph_express.Graph()
Layout = graph_express.Layout()
```

Note that all implemented methods are static and also exposed by `graph_express.graph_express` (see example above).

#### Centrality

Computes weighted or unweighted (in-/out-) degree, bridging, and brokering centrality. Wrappers available for NetworkX (`nx`) and NetworKit (`nk`).

```python
from graph_express import Centrality

# Centrality.bridging_centrality
# Centrality.bridging_coef
# Centrality.brokering_centrality
# Centrality.degree
# Centrality.in_degree
# Centrality.nk_centrality
# Centrality.nx_centrality
# Centrality.out_degree
# Centrality.weighted_degree
# Centrality.weighted_in_degree
# Centrality.weighted_out_degree
```

#### Community

Computes Louvain or Leiden community modules, as implemented by the authors. Wrappers available for cdlib and NetworKit (`nk`).

```python
from graph_express import Community

# Community.cdlib_community
# Community.leiden
# Community.louvain
# Community.nk_community
```

#### Convert

Converts graphs from and to igraph (`ig`), NetworKit (`nk`), NetworkX (`nx`), Pandas (`pd`), and PyTorch Geometric (`pyg`) formats.

```python
from graph_express import Convert

# Convert.ig2nk
# Convert.ig2nx
# Convert.nk2ig
# Convert.nk2nx
# Convert.nx2ig
# Convert.nx2nk
# Convert.nx2pyg
# Convert.pd2nx
# Convert.pyg2nx
```

#### Draw

Plots network graphs using NetworkX (`nx`) or Plotly, as well as degree histograms and similarity matrices among graphs.

```python
from graph_express import Draw

# Draw.draw
# Draw.draw_nx
# Draw.draw_plotly
# Draw.histogram
# Draw.similarity_matrix
```

#### Graph

Convenience functions to read or write from file, as well as manipulate graph objects.

```python
from graph_express import Graph

# Graph.adjacency
# Graph.agg_edge_attr
# Graph.agg_nodes
# Graph.compose
# Graph.density
# Graph.diameter
# Graph.edges
# Graph.graph
# Graph.info
# Graph.is_graph
# Graph.isolates
# Graph.k_core
# Graph.nodes
# Graph.read_graph
# Graph.remove_edges
# Graph.remove_nodes
# Graph.remove_selfloop_edges
# Graph.set_edge_attributes
# Graph.set_node_attributes
# Graph.write_graph
```

#### Layout

Calculate node positions to use for `graph_express.draw`.

```python
from graph_express import Layout

# Layout.layout
# Layout.circular_layout
# Layout.forceatlas2_layout
# Layout.kamada_kawai_layout
# Layout.random_layout
```

___

### Command line interface

An experimental CLI is partially implemented and may be executed with `graph-express`.

```
graph-express [-h] [-o OUTPUT] [-a ATTRS [ATTRS ...]] [-c NODE_COLOR]
               [-e EDGE_ATTR [EDGE_ATTR ...]] [-g GROUPS] [-k K_CORE]
               [-l LAYOUT] [-n NODE_ATTR [NODE_ATTR ...]] [-p POS]
               [-r SEED] [-s SOURCE] [-t TARGET] [--directed]
               [--multigraph] [--no-edges-attrs] [--no-node-attrs]
               [--normalized] [--selfloops]
               {build,compute,plot} input [input ...]

positional arguments:
  {build,compute,plot}  Action to execute.
  input                 Path to input graphs or data set files.

options:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        Output path to write returned data.
  -a ATTRS [ATTRS ...], --attrs ATTRS [ATTRS ...]
                        Available attributes: ['bridging_centrality',
                        'bridging_coef', 'brokering_centrality', 'degree',
                        'in_degree', 'nk_centrality', 'nx_centrality',
                        'out_degree', 'weighted_degree', 'weighted_in_degree',
                        'weighted_out_degree', 'cdlib_community', 'label',
                        'leiden', 'louvain', 'nk_community'].
  -c NODE_COLOR, --color NODE_COLOR
                        Set node color (example: '#ccc').
  -e EDGE_ATTR [EDGE_ATTR ...], --edge-attrs EDGE_ATTR [EDGE_ATTR ...]
                        Set edge attributes to consider when building graphs.
  -g GROUPS, --groups GROUPS
                        Get node groups from file (containing two columns,
                        indexed by 'id').
  -k K_CORE, --k-core K_CORE
                        Apply k-core to graph.
  -l LAYOUT, --layout LAYOUT
                        Available layouts: ['circular_layout',
                        'forceatlas2_layout', 'kamada_kawai_layout', 'layout',
                        'random_layout'] (default: 'kamada_kawai').
  -n NODE_ATTR [NODE_ATTR ...], --node-attrs NODE_ATTR [NODE_ATTR ...]
                        Set node attributes to consider when building graphs.
  -p POS, --positions POS
                        Get node 2 or 3-dimensional positions from file.
  -r SEED, --random-seed SEED
                        Specify random seed for predictable randomness.
  -s SOURCE, --source SOURCE
                        Field name to consider as source.
  -t TARGET, --target TARGET
                        Field name to consider as target.
  --directed            Set as directed graph.
  --multigraph          Set as multigraph (allow multiple edges connecting a
                        same pair of nodes).
  --no-edges-attrs      Ignore edge attributes when building graphs.
  --no-node-attrs       Ignore node attributes when building graphs.
  --normalized          Returns normalized centrality values (from 0 to 1.0).
  --selfloops           Allow edges connecting a node to itself.
```

___

## References

* [cdlib](https://cdlib.readthedocs.io/)
* [Datashader](http://datashader.org)
* [igraph](https://igraph.org)
* [Leiden](https://leidenalg.readthedocs.io)
* [Louvain](https://python-louvain.readthedocs.io)
* [NetworkX](https://networkx.github.io)
* [Networkit](https://networkit.github.io/)
* [Pandas](https://pandas.pydata.org/)
* [Plotly](https://plot.ly)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nelsonaloysio/graph-express",
    "name": "graph-express",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "network graph",
    "author": "['Nelson Aloysio Reis de Almeida Passos']",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/c7/95/b859416d77f29e6c93cdd48a99778e8ab39d5d1ed973dceccfb5f1f3c5c2/graph_express-1.0a3.tar.gz",
    "platform": null,
    "description": "# graph-express\n\nPython package for the analysis and visualization of network graphs with familiar libraries such as\n[NetworkX](https://networkx.org/), [NetworKit](https://networkit.github.io/), [igraph](https://igraph.org/), [cdlib](https://cdlib.readthedocs.io/en/latest/), and [Plotly](https://plotly.com/).\n\n## Requirements\n\n* **Python 3.6.8+**\n* cdlib>=0.3.0\n* datashader>=0.10.0\n* kaleido>=0.2.1\n* leidenalg>=0.8.3\n* networkit>=7.0\n* networkx>=2.3\n* networkx-gdf>=1.1\n* openpyxl>=3.1.2\n* pandas>=0.25.3\n* plotly>=3.10.0\n* python-igraph>=0.8.3\n* python-louvain>=0.14\n\n## Usage\n\n> The following is an overview of the package, to be replaced with guidelines detailing its usage with examples.\n\n### Import high-level class\n\n```python\nimport graph_express.graph_express as gx\n```\n\n#### Read graph from file\n\nAccepted extensions include all formats supported by [networkx](https://networkx.org/documentation/stable/reference/readwrite/index.html) and [networkx-gdf](https://pypi.org/project/networkx-gdf/).\n\n```python\nG = gx.read_graph(\"/path/to/file.ext\", ...)\n```\n\n#### Compute centrality and communities\n\nGenerates a data frame with node centrality values and communities, e.g., using the Leiden algorithm:\n\n```python\ndf = gx.compute(G, attrs=[\"degree\", \"leiden\"])\n```\n\n#### Plot network graph\n\nCalculates positions and plots the network graph.\n\n```python\nfig = gx.draw(G, layout=\"forceatlas2\", renderer=\"networkx\")\n```\n\n<!-- For details on implemented layouts and renderers, please see the [documentation](). -->\n\n___\n\n### Import specific classes\n\nThis package implements six classes with static methods to allow inheriting their implemented methods:\n\n```python\nimport graph_express\n\nCentrality = graph_express.Centrality()\nCommunity = graph_express.Community()\nConvert = graph_express.Convert()\nDraw = graph_express.Draw()\nGraph = graph_express.Graph()\nLayout = graph_express.Layout()\n```\n\nNote that all implemented methods are static and also exposed by `graph_express.graph_express` (see example above).\n\n#### Centrality\n\nComputes weighted or unweighted (in-/out-) degree, bridging, and brokering centrality. Wrappers available for NetworkX (`nx`) and NetworKit (`nk`).\n\n```python\nfrom graph_express import Centrality\n\n# Centrality.bridging_centrality\n# Centrality.bridging_coef\n# Centrality.brokering_centrality\n# Centrality.degree\n# Centrality.in_degree\n# Centrality.nk_centrality\n# Centrality.nx_centrality\n# Centrality.out_degree\n# Centrality.weighted_degree\n# Centrality.weighted_in_degree\n# Centrality.weighted_out_degree\n```\n\n#### Community\n\nComputes Louvain or Leiden community modules, as implemented by the authors. Wrappers available for cdlib and NetworKit (`nk`).\n\n```python\nfrom graph_express import Community\n\n# Community.cdlib_community\n# Community.leiden\n# Community.louvain\n# Community.nk_community\n```\n\n#### Convert\n\nConverts graphs from and to igraph (`ig`), NetworKit (`nk`), NetworkX (`nx`), Pandas (`pd`), and PyTorch Geometric (`pyg`) formats.\n\n```python\nfrom graph_express import Convert\n\n# Convert.ig2nk\n# Convert.ig2nx\n# Convert.nk2ig\n# Convert.nk2nx\n# Convert.nx2ig\n# Convert.nx2nk\n# Convert.nx2pyg\n# Convert.pd2nx\n# Convert.pyg2nx\n```\n\n#### Draw\n\nPlots network graphs using NetworkX (`nx`) or Plotly, as well as degree histograms and similarity matrices among graphs.\n\n```python\nfrom graph_express import Draw\n\n# Draw.draw\n# Draw.draw_nx\n# Draw.draw_plotly\n# Draw.histogram\n# Draw.similarity_matrix\n```\n\n#### Graph\n\nConvenience functions to read or write from file, as well as manipulate graph objects.\n\n```python\nfrom graph_express import Graph\n\n# Graph.adjacency\n# Graph.agg_edge_attr\n# Graph.agg_nodes\n# Graph.compose\n# Graph.density\n# Graph.diameter\n# Graph.edges\n# Graph.graph\n# Graph.info\n# Graph.is_graph\n# Graph.isolates\n# Graph.k_core\n# Graph.nodes\n# Graph.read_graph\n# Graph.remove_edges\n# Graph.remove_nodes\n# Graph.remove_selfloop_edges\n# Graph.set_edge_attributes\n# Graph.set_node_attributes\n# Graph.write_graph\n```\n\n#### Layout\n\nCalculate node positions to use for `graph_express.draw`.\n\n```python\nfrom graph_express import Layout\n\n# Layout.layout\n# Layout.circular_layout\n# Layout.forceatlas2_layout\n# Layout.kamada_kawai_layout\n# Layout.random_layout\n```\n\n___\n\n### Command line interface\n\nAn experimental CLI is partially implemented and may be executed with `graph-express`.\n\n```\ngraph-express [-h] [-o OUTPUT] [-a ATTRS [ATTRS ...]] [-c NODE_COLOR]\n               [-e EDGE_ATTR [EDGE_ATTR ...]] [-g GROUPS] [-k K_CORE]\n               [-l LAYOUT] [-n NODE_ATTR [NODE_ATTR ...]] [-p POS]\n               [-r SEED] [-s SOURCE] [-t TARGET] [--directed]\n               [--multigraph] [--no-edges-attrs] [--no-node-attrs]\n               [--normalized] [--selfloops]\n               {build,compute,plot} input [input ...]\n\npositional arguments:\n  {build,compute,plot}  Action to execute.\n  input                 Path to input graphs or data set files.\n\noptions:\n  -h, --help            show this help message and exit\n  -o OUTPUT, --output OUTPUT\n                        Output path to write returned data.\n  -a ATTRS [ATTRS ...], --attrs ATTRS [ATTRS ...]\n                        Available attributes: ['bridging_centrality',\n                        'bridging_coef', 'brokering_centrality', 'degree',\n                        'in_degree', 'nk_centrality', 'nx_centrality',\n                        'out_degree', 'weighted_degree', 'weighted_in_degree',\n                        'weighted_out_degree', 'cdlib_community', 'label',\n                        'leiden', 'louvain', 'nk_community'].\n  -c NODE_COLOR, --color NODE_COLOR\n                        Set node color (example: '#ccc').\n  -e EDGE_ATTR [EDGE_ATTR ...], --edge-attrs EDGE_ATTR [EDGE_ATTR ...]\n                        Set edge attributes to consider when building graphs.\n  -g GROUPS, --groups GROUPS\n                        Get node groups from file (containing two columns,\n                        indexed by 'id').\n  -k K_CORE, --k-core K_CORE\n                        Apply k-core to graph.\n  -l LAYOUT, --layout LAYOUT\n                        Available layouts: ['circular_layout',\n                        'forceatlas2_layout', 'kamada_kawai_layout', 'layout',\n                        'random_layout'] (default: 'kamada_kawai').\n  -n NODE_ATTR [NODE_ATTR ...], --node-attrs NODE_ATTR [NODE_ATTR ...]\n                        Set node attributes to consider when building graphs.\n  -p POS, --positions POS\n                        Get node 2 or 3-dimensional positions from file.\n  -r SEED, --random-seed SEED\n                        Specify random seed for predictable randomness.\n  -s SOURCE, --source SOURCE\n                        Field name to consider as source.\n  -t TARGET, --target TARGET\n                        Field name to consider as target.\n  --directed            Set as directed graph.\n  --multigraph          Set as multigraph (allow multiple edges connecting a\n                        same pair of nodes).\n  --no-edges-attrs      Ignore edge attributes when building graphs.\n  --no-node-attrs       Ignore node attributes when building graphs.\n  --normalized          Returns normalized centrality values (from 0 to 1.0).\n  --selfloops           Allow edges connecting a node to itself.\n```\n\n___\n\n## References\n\n* [cdlib](https://cdlib.readthedocs.io/)\n* [Datashader](http://datashader.org)\n* [igraph](https://igraph.org)\n* [Leiden](https://leidenalg.readthedocs.io)\n* [Louvain](https://python-louvain.readthedocs.io)\n* [NetworkX](https://networkx.github.io)\n* [Networkit](https://networkit.github.io/)\n* [Pandas](https://pandas.pydata.org/)\n* [Plotly](https://plot.ly)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python package for the analysis and visualization of network graphs.",
    "version": "1.0a3",
    "project_urls": {
        "Homepage": "https://github.com/nelsonaloysio/graph-express",
        "Source": "https://github.com/nelsonaloysio/graph_express",
        "Tracker": "https://github.com/nelsonaloysio/graph_express/issues"
    },
    "split_keywords": [
        "network",
        "graph"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ab8cba1bf9577c271a9938efe5d97acd71edb9a613a4d82e16667778ca6cae61",
                "md5": "ed600d67f0ab9fd29d060793258b2fb1",
                "sha256": "851edd005cb4523af4fd9804e95abcc41e4b2c79a6ae9c67e65ab84a7813d115"
            },
            "downloads": -1,
            "filename": "graph_express-1.0a3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ed600d67f0ab9fd29d060793258b2fb1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 25570,
            "upload_time": "2024-02-24T02:09:48",
            "upload_time_iso_8601": "2024-02-24T02:09:48.335511Z",
            "url": "https://files.pythonhosted.org/packages/ab/8c/ba1bf9577c271a9938efe5d97acd71edb9a613a4d82e16667778ca6cae61/graph_express-1.0a3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c795b859416d77f29e6c93cdd48a99778e8ab39d5d1ed973dceccfb5f1f3c5c2",
                "md5": "74fe2d98731201ea40614354b9204c55",
                "sha256": "0a9e6252b4703da87c5b3ec47969b8249ea5fdfc046bc952c8324060ca579d6e"
            },
            "downloads": -1,
            "filename": "graph_express-1.0a3.tar.gz",
            "has_sig": false,
            "md5_digest": "74fe2d98731201ea40614354b9204c55",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 23258,
            "upload_time": "2024-02-24T02:09:50",
            "upload_time_iso_8601": "2024-02-24T02:09:50.158824Z",
            "url": "https://files.pythonhosted.org/packages/c7/95/b859416d77f29e6c93cdd48a99778e8ab39d5d1ed973dceccfb5f1f3c5c2/graph_express-1.0a3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-24 02:09:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nelsonaloysio",
    "github_project": "graph-express",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "cdlib",
            "specs": [
                [
                    ">=",
                    "0.3.0"
                ]
            ]
        },
        {
            "name": "datashader",
            "specs": [
                [
                    ">=",
                    "0.10.0"
                ]
            ]
        },
        {
            "name": "kaleido",
            "specs": [
                [
                    ">=",
                    "0.2.1"
                ]
            ]
        },
        {
            "name": "leidenalg",
            "specs": [
                [
                    ">=",
                    "0.8.3"
                ]
            ]
        },
        {
            "name": "networkit",
            "specs": [
                [
                    ">=",
                    "7.0"
                ]
            ]
        },
        {
            "name": "networkx",
            "specs": [
                [
                    ">=",
                    "2.3"
                ]
            ]
        },
        {
            "name": "networkx_gdf",
            "specs": [
                [
                    ">=",
                    "1.1"
                ]
            ]
        },
        {
            "name": "openpyxl",
            "specs": [
                [
                    ">=",
                    "3.1.2"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "0.25.3"
                ]
            ]
        },
        {
            "name": "plotly",
            "specs": [
                [
                    ">=",
                    "3.10.0"
                ]
            ]
        },
        {
            "name": "python-igraph",
            "specs": [
                [
                    ">=",
                    "0.8.3"
                ]
            ]
        },
        {
            "name": "python-louvain",
            "specs": [
                [
                    ">=",
                    "0.14"
                ]
            ]
        }
    ],
    "lcname": "graph-express"
}
        
Elapsed time: 0.18959s