Interactive network visualization in Python and Dash, powered by Cytoscape.js
Branch: master
Clone or download
Latest commit 11525e9 Feb 5, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Added Cytoscape component, not working yet Aug 7, 2018
.github Update import statement `import dash_cytoscape` -> `import dash_cytsc… Jan 27, 2019
assets Add CSS file for testing purposes Jan 18, 2019
dash_cytoscape Bump Version Jan 22, 2019
demos Add server variable to usage-phylogeny.py Feb 1, 2019
src Change setProps -> this.props.setProps Jan 18, 2019
tests Update requirements to latest versions Jan 18, 2019
.babelrc Added Cytoscape component, not working yet Aug 7, 2018
.eslintignore Added Cytoscape component, not working yet Aug 7, 2018
.eslintrc Added Cytoscape component, not working yet Aug 7, 2018
.gitignore Files updated by dash-component-boilerplate refactoring Jan 18, 2019
.npmignore Add venv to npmignore Jan 25, 2019
.prettierrc Added Cytoscape component, not working yet Aug 7, 2018
.pylintrc Added Cytoscape component, not working yet Aug 7, 2018
CHANGELOG.md Updated Changelog Feb 1, 2019
CODE_OF_CONDUCT.md releasing v0.0.1 (#10) Nov 3, 2018
CONTRIBUTING.md Substantially Update the Contributing Guidelines Jan 25, 2019
LICENSE Updated Readme Oct 25, 2018
MANIFEST.in Added LICENSE to manifest.in Jan 19, 2019
README.md
_validate_init.py Files added by dash-component-boilerplate refactoring Jan 18, 2019
package.json Bump Version Jan 22, 2019
requirements.txt Update requirements to latest versions Jan 18, 2019
setup.py
usage-advanced.py Optimize Imports for demos Jan 27, 2019
usage-elements.py Update import statement `import dash_cytoscape` -> `import dash_cytsc… Jan 27, 2019
usage-events.py Optimize Imports for demos Jan 27, 2019
usage-stylesheet.py Update import statement `import dash_cytoscape` -> `import dash_cytsc… Jan 27, 2019
usage.py Optimize Imports for demos Jan 27, 2019
webpack.config.js Files updated by dash-component-boilerplate refactoring Jan 18, 2019
webpack.serve.config.js Added Cytoscape component, not working yet Aug 7, 2018
yarn.lock

README.md

Dash Cytoscape GitHub license PyPi Version

A Component Library for Dash aimed at facilitating network visualization in Python, wrapped around Cytoscape.js.

Interacting with the stylesheet: usage-stylesheet-demo

Interacting with the elements: usage-elements-demo

Getting Started

Prerequisites

Make sure that the following python packages are installed:

dash==0.35.1
dash-renderer==0.14.3
dash-html-components==0.13.4
dash-core-components==0.42.1

Older versions are not necessarily incompatible, but have not been extensively tested.

Usage

Install the library using pip:

pip install dash-cytoscape

Create the following example inside an app.py file:

import dash
import dash_cytoscape as cyto
import dash_html_components as html

app = dash.Dash(__name__)
app.layout = html.Div([
    cyto.Cytoscape(
        id='cytoscape',
        elements=[
            {'data': {'id': 'one', 'label': 'Node 1'}, 'position': {'x': 50, 'y': 50}},
            {'data': {'id': 'two', 'label': 'Node 2'}, 'position': {'x': 200, 'y': 200}},
            {'data': {'source': 'one', 'target': 'two','label': 'Node 1 to 2'}}
        ],
        layout={'name': 'preset'}
    )
])

if __name__ == '__main__':
    app.run_server(debug=True)

Documentation

View the Dash Cytoscape User Guide to get started now. You can also use the component reference to find how to use a certain feature.

To learn more about the core Dash components and how to use callbacks, view the Dash documentation.

For supplementary information about the underlying Javascript API, view the Cytoscape.js documentation.

Development

Please follow the following steps for local testing:

  1. Clone the repo
$ git clone https://github.com/plotly/dash-cytoscape.git
  1. In order to run the Python builds (npm run build:py) you need to create a venv for this project. Make sure you have virtualenv correctly installed and run this:
$ mkdir dash_cytoscape_dev
$ cd dash_cytoscape_dev
$ virtualenv venv  # Create a virtual env
$ source venv/bin/activate  # Activate the venv

To activate in windows:

> venv\Scripts\activate

(and then repeat step 3).

  1. Install the JavaScript dependencies and build the code:
$ yarn
$ yarn run build:all
  1. Install the library
$ python setup.py install

Notes

Package manager

Our preferred package manager for this project is Yarn. Therefore we use yarn.lock rather than package-lock.json. If you decide to start using npm for package management (which will create package-lock.json) and you commit this project to Dokku, make sure to delete yarn.lock.

License

Dash, Cytoscape.js and Dash Cytoscape are licensed under MIT. Please view LICENSE for more details.

Contact and Support

See https://plot.ly/dash/support for ways to get in touch.

Acknowledgments

Huge thanks to the Cytoscape Consortium and the Cytoscape.js team for their contribution in making such a complete API for creating interactive networks. This library would not have been possible without their massive work!

The Pull Request and Issue Templates were inspired from the scikit-learn project.