bindings/jupyter/notebooks/graph-builder.ipynb (81 lines of code) (raw):

{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Graph Builder\n", "\n", "## Usage" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "30dd102baceb4b6a8b2c09d8a6f9e05f", "version_major": 2, "version_minor": 0 }, "text/plain": [ "GraphBuilder(props='{\"data\": {\"nodes\": [{\"id\": \"1\"}, {\"id\": \"2\"}, {\"id\": \"3\"}], \"edges\": [{\"id\": \"e1\", \"source…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from mlvis import GraphBuilder\n", "from IPython.display import display\n", "\n", "data = {\n", " \"nodes\": [\n", " {\"id\": '1'},\n", " {\"id\": '2'},\n", " {\"id\": '3'}\n", " ],\n", " \"edges\": [\n", " {\"id\": 'e1', \"sourceId\": '1', \"targetId\": '2'},\n", " {\"id\": 'e2', \"sourceId\": '1', \"targetId\": '3'},\n", " {\"id\": 'e3', \"sourceId\": '2', \"targetId\": '3'}\n", " ]\n", "}\n", "\n", "graph = GraphBuilder(props={'data': data,\n", " \"nodeSize\": 10, \n", " \"nodeColor\": \"#7743CE\", \n", " \"edgeWidth\": 1, \n", " \"edgeColor\": \"#777777\",\n", " \"height\": 500})\n", "\n", "display(graph)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.0" } }, "nbformat": 4, "nbformat_minor": 2 }