rosmontis


Namerosmontis JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/apo11o-m/rosmontis
SummaryCreate graph images with help of graphviz module
upload_time2022-12-18 07:37:26
maintainer
docs_urlNone
authorRick Wang
requires_python>=3
licenseMIT
keywords graph visualization dot render
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Rosmontis

Rosmontis is a lightweight library that outputs a graph image using [graphviz](https://github.com/xflr6/graphviz) based on the adjacency list, dictionary, or matrix. This module simplified the steps of creating a graph, where it adds the nodes and edges automatically from the input data to graphviz, creating the graph in one function call.

## Installation

1. Currently, `rosmontis` only supports Python 3. Use `pip` to install:

```shell
$ pip install --upgrade rosmontis
```

2. You also need to have `graphviz` installed in order to generate the image based on the `.dot` files. See the official website for the installation process: [Graphviz.org](https://graphviz.org/download/).

## Usage & Examples

### Unweighted Undirected Graph in Adjacency List

```python
import rosmontis

g = [['A', ['B', 'E']],   # node A is connected to node B and node E
     ['B', ['E', 'C']],   # node B is connected to node E and node C
     ['C', ['D']], 
     ['D', ['E', 'F']]]

# output a png image representing the graph in the same
# directory of this file.
rosmontis.renderGraphList(graph=g, graphName="example1", weighted=False, directed=False)
```
<img src="https://raw.githubusercontent.com/apo11o-M/rosmontis/main/img/example1.png">


### Weighted Undirected Graph in Adjacency Dictionary

```python
import rosmontis

# node A is connected to node B with weight of 2, and node E with weight of 0.5
# node B is connected to node E with weight of 0.2, and node C with weight of 3
# ... etc
g = {'A': [['B', 2], ['E', 0.5]], 
     'B': [['E', 0.2], ['C', 3]], 
     'C': [['D', 7]], 
     'D': [['E', 0.15], ['F', 1.6]]}

rosmontis.renderGraphDict(graph=g, graphName="example2", weighted=True, directed=False)
```
<img src="https://raw.githubusercontent.com/apo11o-M/rosmontis/main/img/example2.png">

### Unweighted Undirected Graph in Adjacency Matrix

```python
import rosmontis

# Note column 0 and row 0 are the headers/labels of each node. The actual weight
# starts from row 1 column 1
# 1 indicates there is an edge, 0 indicates no connection
g = [[None, "A", "B", "C", "D", "E", "F"],
     ["A",   0,   0,   0,   0,   1,   1 ],
     ["B",   0,   0,   1,   0,   0,   1 ],
     ["C",   0,   1,   0,   1,   0,   0 ],
     ["D",   0,   0,   1,   0,   1,   1 ],
     ["E",   1,   0,   0,   1,   0,   1 ],
     ["F",   1,   1,   0,   1,   1,   0 ]]

rosmontis.renderGraphMatrix(graph=g, graphName="example3", weighted=False, directed=False)
```
<img src="https://raw.githubusercontent.com/apo11o-M/rosmontis/main/img/example3.png">

### Weighted Directed Graph in Adjacency Matrix

```python
import rosmontis

# Change the numbers from 1 to the weight value. Numbers other than 0 represents
# a connection, vice versa.
g = [[None, "A",   "B",   "C",   "D",   "E",   "F"  ],
     ["A",   0,     2,     0,     0,     0,     3   ],
     ["B",   0,     0,     0,     0,     0.2,   0   ],
     ["C",   0,     0,     0,     7.5,   0,     13  ],
     ["D",   0,     0,     0,     0,     0,     1.6 ],
     ["E",   0,     0,     0,     0,     0,     -4  ],
     ["F",   0,     0,     0,     0,     0,     0   ]]

rosmontis.renderGraphMatrix(graph=g, graphName="example4", weighted=True, directed=True)
```
<img src="https://raw.githubusercontent.com/apo11o-M/rosmontis/main/img/example4.png">

See more examples in the `examples/` folder.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/apo11o-m/rosmontis",
    "name": "rosmontis",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": "",
    "keywords": "graph,visualization,dot,render",
    "author": "Rick Wang",
    "author_email": "yenhao0508@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/01/fb/3edf20865a6cea9096dc4335ff9487f1bdd43ce20c5a4e61f9fe366a2618/rosmontis-1.0.0.tar.gz",
    "platform": null,
    "description": "# Rosmontis\n\nRosmontis is a lightweight library that outputs a graph image using [graphviz](https://github.com/xflr6/graphviz) based on the adjacency list, dictionary, or matrix. This module simplified the steps of creating a graph, where it adds the nodes and edges automatically from the input data to graphviz, creating the graph in one function call.\n\n## Installation\n\n1. Currently, `rosmontis` only supports Python 3. Use `pip` to install:\n\n```shell\n$ pip install --upgrade rosmontis\n```\n\n2. You also need to have `graphviz` installed in order to generate the image based on the `.dot` files. See the official website for the installation process: [Graphviz.org](https://graphviz.org/download/).\n\n## Usage & Examples\n\n### Unweighted Undirected Graph in Adjacency List\n\n```python\nimport rosmontis\n\ng = [['A', ['B', 'E']],   # node A is connected to node B and node E\n     ['B', ['E', 'C']],   # node B is connected to node E and node C\n     ['C', ['D']], \n     ['D', ['E', 'F']]]\n\n# output a png image representing the graph in the same\n# directory of this file.\nrosmontis.renderGraphList(graph=g, graphName=\"example1\", weighted=False, directed=False)\n```\n<img src=\"https://raw.githubusercontent.com/apo11o-M/rosmontis/main/img/example1.png\">\n\n\n### Weighted Undirected Graph in Adjacency Dictionary\n\n```python\nimport rosmontis\n\n# node A is connected to node B with weight of 2, and node E with weight of 0.5\n# node B is connected to node E with weight of 0.2, and node C with weight of 3\n# ... etc\ng = {'A': [['B', 2], ['E', 0.5]], \n     'B': [['E', 0.2], ['C', 3]], \n     'C': [['D', 7]], \n     'D': [['E', 0.15], ['F', 1.6]]}\n\nrosmontis.renderGraphDict(graph=g, graphName=\"example2\", weighted=True, directed=False)\n```\n<img src=\"https://raw.githubusercontent.com/apo11o-M/rosmontis/main/img/example2.png\">\n\n### Unweighted Undirected Graph in Adjacency Matrix\n\n```python\nimport rosmontis\n\n# Note column 0 and row 0 are the headers/labels of each node. The actual weight\n# starts from row 1 column 1\n# 1 indicates there is an edge, 0 indicates no connection\ng = [[None, \"A\", \"B\", \"C\", \"D\", \"E\", \"F\"],\n     [\"A\",   0,   0,   0,   0,   1,   1 ],\n     [\"B\",   0,   0,   1,   0,   0,   1 ],\n     [\"C\",   0,   1,   0,   1,   0,   0 ],\n     [\"D\",   0,   0,   1,   0,   1,   1 ],\n     [\"E\",   1,   0,   0,   1,   0,   1 ],\n     [\"F\",   1,   1,   0,   1,   1,   0 ]]\n\nrosmontis.renderGraphMatrix(graph=g, graphName=\"example3\", weighted=False, directed=False)\n```\n<img src=\"https://raw.githubusercontent.com/apo11o-M/rosmontis/main/img/example3.png\">\n\n### Weighted Directed Graph in Adjacency Matrix\n\n```python\nimport rosmontis\n\n# Change the numbers from 1 to the weight value. Numbers other than 0 represents\n# a connection, vice versa.\ng = [[None, \"A\",   \"B\",   \"C\",   \"D\",   \"E\",   \"F\"  ],\n     [\"A\",   0,     2,     0,     0,     0,     3   ],\n     [\"B\",   0,     0,     0,     0,     0.2,   0   ],\n     [\"C\",   0,     0,     0,     7.5,   0,     13  ],\n     [\"D\",   0,     0,     0,     0,     0,     1.6 ],\n     [\"E\",   0,     0,     0,     0,     0,     -4  ],\n     [\"F\",   0,     0,     0,     0,     0,     0   ]]\n\nrosmontis.renderGraphMatrix(graph=g, graphName=\"example4\", weighted=True, directed=True)\n```\n<img src=\"https://raw.githubusercontent.com/apo11o-M/rosmontis/main/img/example4.png\">\n\nSee more examples in the `examples/` folder.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Create graph images with help of graphviz module",
    "version": "1.0.0",
    "split_keywords": [
        "graph",
        "visualization",
        "dot",
        "render"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "99e2ff70ccc06cf796ec4560048fe854",
                "sha256": "e4fec36aad72db038acb48d92bda13de99c102a1a68a649e98d2c5113dada7a7"
            },
            "downloads": -1,
            "filename": "rosmontis-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "99e2ff70ccc06cf796ec4560048fe854",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3",
            "size": 4098,
            "upload_time": "2022-12-18T07:37:24",
            "upload_time_iso_8601": "2022-12-18T07:37:24.897780Z",
            "url": "https://files.pythonhosted.org/packages/8d/f6/f11c6ad4ec65e3ade2dabe44c82f3685578ccee5ddb88435edc4222c6977/rosmontis-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "58b9399bef1744f3a816959944b48f9a",
                "sha256": "3d4e5c897243c06a8e241c2a36e0eded84d2e8b10c8e7941ee616d66168875b5"
            },
            "downloads": -1,
            "filename": "rosmontis-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "58b9399bef1744f3a816959944b48f9a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 4130,
            "upload_time": "2022-12-18T07:37:26",
            "upload_time_iso_8601": "2022-12-18T07:37:26.538016Z",
            "url": "https://files.pythonhosted.org/packages/01/fb/3edf20865a6cea9096dc4335ff9487f1bdd43ce20c5a4e61f9fe366a2618/rosmontis-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-18 07:37:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "apo11o-m",
    "github_project": "rosmontis",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "rosmontis"
}
        
Elapsed time: 0.26749s