Last active
November 23, 2021 15:15
-
-
Save pathologicalhandwaving/d25feb333bb2a2dfe3806e1e199878b0 to your computer and use it in GitHub Desktop.
Word Ladder Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "metadata": { | |
| "name": "Word_Ladder_network_vis" | |
| }, | |
| "nbformat": 3, | |
| "nbformat_minor": 0, | |
| "worksheets": [ | |
| { | |
| "cells": [ | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "Some backgrounf about Word_ladder\n", | |
| "http://en.wikipedia.org/w/index.php?title=Word_ladder\n", | |
| "\n", | |
| "Take the standard UNIX dictionary ``/usr/share/dict/words`` and create a function to find all neighering words with Hamming distance one from the argument." | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "all_words = [ w.strip().upper() for w in open(\"/usr/share/dict/words\") ]\n", | |
| "\n", | |
| "n_dict = {}\n", | |
| "\n", | |
| "for w in all_words:\n", | |
| " lw = len(w)\n", | |
| " n_dict.setdefault(lw,set())\n", | |
| " n_dict[lw].add(w)\n", | |
| " \n", | |
| "alphabets = [chr(x) for x in range(ord('A'),ord('Z')+1)]\n", | |
| "\n", | |
| "def find_neighbors(w):\n", | |
| " \n", | |
| " lw = len(w)\n", | |
| " \n", | |
| " if w not in n_dict[lw]:\n", | |
| " raise StopIteration\n", | |
| " \n", | |
| " for p in range(lw):\n", | |
| " for a in alphabets:\n", | |
| " nw = list(w)\n", | |
| " if a == nw[p]: \n", | |
| " continue\n", | |
| " nw[p] = a\n", | |
| " nw = \"\".join(nw)\n", | |
| " if nw in n_dict[lw]:\n", | |
| " yield nw" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [], | |
| "prompt_number": 1 | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "The ``find_path`` implements the BFS to find a path between two word of the same length." | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "def find_path(word1, word2, show_path=False):\n", | |
| "\n", | |
| " assert len(word1) == len(word2)\n", | |
| "\n", | |
| " visited_words = set()\n", | |
| " queue = []\n", | |
| " track_back = {}\n", | |
| " track_back[word1] = None\n", | |
| " w1 = word1\n", | |
| " found = False\n", | |
| " while 1:\n", | |
| " for w in find_neighbors(w1):\n", | |
| " if w in track_back:\n", | |
| " continue\n", | |
| " track_back[w] = w1\n", | |
| " if w == word2:\n", | |
| " found = True\n", | |
| " break\n", | |
| " else:\n", | |
| " queue.append(w)\n", | |
| " if found:\n", | |
| " break\n", | |
| " elif len(queue) == 0:\n", | |
| " found = False\n", | |
| " break\n", | |
| " else:\n", | |
| " w1 = queue.pop(0)\n", | |
| " if found:\n", | |
| " trace = []\n", | |
| " w2 = word2\n", | |
| " while 1:\n", | |
| " trace.append(w2)\n", | |
| " w = track_back[w2]\n", | |
| " if w == None:\n", | |
| " break\n", | |
| " w2 = w\n", | |
| " #print word1, word2, len( trace ) - 1 , list(reversed(trace))\n", | |
| " print word1, word2, len( trace ) - 1\n", | |
| " if show_path == True:\n", | |
| " trace.reverse()\n", | |
| " print \":\".join(trace)\n", | |
| " else:\n", | |
| " #raise BaseException, \"not possible\"\n", | |
| " print \"not possible\" " | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [], | |
| "prompt_number": 2 | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "``COLD`` and ``CORD`` are within distance 1." | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "find_path(\"COLD\",\"CORD\")" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "output_type": "stream", | |
| "stream": "stdout", | |
| "text": [ | |
| "COLD CORD 1\n" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 3 | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "``COLD`` and ``WARM`` are within distance 4. They are connected by ``COLD`` -> ``WOLD`` -> ``WORD`` -> ``WARD`` -> ``WARM``" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "find_path(\"COLD\",\"WARM\")\n", | |
| "find_path(\"COLD\",\"WARM\", show_path=True)" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "output_type": "stream", | |
| "stream": "stdout", | |
| "text": [ | |
| "COLD WARM 4\n", | |
| "COLD" | |
| ] | |
| }, | |
| { | |
| "output_type": "stream", | |
| "stream": "stdout", | |
| "text": [ | |
| " WARM 4\n", | |
| "COLD:WOLD:WORD:WARD:WARM\n" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 4 | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "Test the code to go through a number of word pairs." | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "word_pairs = [(\"PIG\", \"STY\"),\n", | |
| "(\"OAT\", \"RYE\"),\n", | |
| "(\"CHIN\", \"NOSE\"),\n", | |
| "(\"PITY\", \"GOOD\"),\n", | |
| "(\"PITCH\", \"TENTS\"),\n", | |
| "(\"FLOUR\", \"BREAD\"),\n", | |
| "(\"BRAVE\", \"BRIEF\")]\n", | |
| "for wp in word_pairs:\n", | |
| " find_path(*wp)" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "output_type": "stream", | |
| "stream": "stdout", | |
| "text": [ | |
| "PIG STY 4\n", | |
| "OAT" | |
| ] | |
| }, | |
| { | |
| "output_type": "stream", | |
| "stream": "stdout", | |
| "text": [ | |
| " RYE 4\n", | |
| "CHIN" | |
| ] | |
| }, | |
| { | |
| "output_type": "stream", | |
| "stream": "stdout", | |
| "text": [ | |
| " NOSE 5\n", | |
| "PITY" | |
| ] | |
| }, | |
| { | |
| "output_type": "stream", | |
| "stream": "stdout", | |
| "text": [ | |
| " GOOD 5\n", | |
| "not possible" | |
| ] | |
| }, | |
| { | |
| "output_type": "stream", | |
| "stream": "stdout", | |
| "text": [ | |
| "\n", | |
| "FLOUR BREAD 6\n", | |
| "BRAVE" | |
| ] | |
| }, | |
| { | |
| "output_type": "stream", | |
| "stream": "stdout", | |
| "text": [ | |
| " BRIEF 8\n" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 5 | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "Set-up ``networkx`` for visualizing the local structure of such network." | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "import networkx as nx\n", | |
| "from IPython.core.display import display_javascript\n", | |
| "#from IPython.frontend.html.notebook import visutils as vis\n", | |
| "import json\n", | |
| "import time\n" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [], | |
| "prompt_number": 6 | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "Load D3.js" | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "%install_ext https://raw.github.com/cschin/ipython_d3_mashup/master/extension/visutils.py\n", | |
| "%reload_ext visutils\n", | |
| "vis.run_js(\"$.getScript('http://d3js.org/d3.v2.js')\")\n", | |
| "vis.run_js(\"$.getScript('https://raw.github.com/cschin/ipython_d3_mashup/master/extension/vis_extension.js')\")\n", | |
| "time.sleep(2)\n", | |
| "vis.run_js(\"IPython.vis_init();\")" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "output_type": "stream", | |
| "stream": "stdout", | |
| "text": [ | |
| "Installed visutils.py. To use it, type:\n", | |
| " %load_ext visutils\n" | |
| ] | |
| }, | |
| { | |
| "javascript": [ | |
| "$.getScript('http://d3js.org/d3.v2.js')" | |
| ], | |
| "output_type": "display_data" | |
| }, | |
| { | |
| "javascript": [ | |
| "$.getScript('https://raw.github.com/cschin/ipython_d3_mashup/master/extension/vis_extension.js')" | |
| ], | |
| "output_type": "display_data" | |
| }, | |
| { | |
| "javascript": [ | |
| "IPython.vis_init();" | |
| ], | |
| "output_type": "display_data" | |
| } | |
| ], | |
| "prompt_number": 7 | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "Set up the visulization \"cell\"/widget." | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "try:\n", | |
| " vis_display.remove()\n", | |
| "except:\n", | |
| " pass\n", | |
| "plot_area_style = {\"position\":\"absolute\",\n", | |
| " \"top\":\"0px\",\n", | |
| " \"width\":\"500px\",\n", | |
| " \"left\":\"850px\",\n", | |
| " \"height\":\"520px\",\n", | |
| " \"border\":\"9px groove\",\n", | |
| " \"background-color\":\"rgba(200,200,200,0.5)\"}\n", | |
| "\n", | |
| "vis_cell = vis.VISCellWidget(name=\"plot_area\", style = plot_area_style)\n", | |
| "\n", | |
| "## attache the container to a \"visual display\"\n", | |
| "vis_display = vis.NotebookVisualDisplay(container = vis_cell)\n", | |
| "\n", | |
| "\n", | |
| "## create the SVG element for D3\n", | |
| "svg_style = {\"width\":\"500px\", \n", | |
| " \"height\":\"445px\",\n", | |
| " \"border\":\"2px solid\"}\n", | |
| "\n", | |
| "svg = vis.SVGWidget(name = \"svg_display\", \n", | |
| " parent = \"plot_area\", \n", | |
| " style = svg_style,\n", | |
| " vis = vis_display)" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "javascript": [ | |
| "IPython.vis_utils.insert_vis_cell(\"plot_area\"); \n", | |
| " $(\"#plot_area\").css(\"top\", \"0px\");\n", | |
| " $(\"#plot_area\").css(\"height\", \"520px\");\n", | |
| " $(\"#plot_area\").css(\"width\", \"500px\");\n", | |
| " $(\"#plot_area\").css(\"position\", \"absolute\");\n", | |
| " $(\"#plot_area\").css(\"border\", \"9px groove\");\n", | |
| " $(\"#plot_area\").css(\"background-color\", \"rgba(200,200,200,0.5)\");\n", | |
| " $(\"#plot_area\").css(\"left\", \"850px\");" | |
| ], | |
| "output_type": "display_data" | |
| } | |
| ], | |
| "prompt_number": 8 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "vis_cell == vis_display.container" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "output_type": "pyout", | |
| "prompt_number": 9, | |
| "text": [ | |
| "True" | |
| ] | |
| } | |
| ], | |
| "prompt_number": 9 | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "Generate the json for d3.js for the force layout." | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "def get_group(w, w1):\n", | |
| " c = 0\n", | |
| " for c1, c2 in zip(w,w1):\n", | |
| " if c1 == c2:\n", | |
| " c += 1\n", | |
| " continue\n", | |
| " break\n", | |
| " return c\n", | |
| "\n", | |
| "def set_g_json(word):\n", | |
| " G=nx.Graph()\n", | |
| " w = word\n", | |
| " for w2 in find_neighbors(w):\n", | |
| " G.add_edge(w, w2, attr_dict={\"l\":1})\n", | |
| " for w3 in find_neighbors(w2):\n", | |
| " if w3 != w:\n", | |
| " G.add_edge(w2, w3, attr_dict={\"l\":2})\n", | |
| " \n", | |
| " def generateD3JSONForG(G):\n", | |
| " s = {\"nodes\":[], \"links\":[]}\n", | |
| " name2Idx = {}\n", | |
| " c = 0\n", | |
| " for n in G.nodes():\n", | |
| " s[\"nodes\"].append({\"name\":n, \"group\":get_group(w,n)})\n", | |
| " name2Idx[n] = c\n", | |
| " c += 1\n", | |
| " for e in G.edges():\n", | |
| " l = G.adj[e[0]][e[1]][\"l\"]\n", | |
| " if l == 1:\n", | |
| " col = \"rgb(0,0,255)\"\n", | |
| " width = 3\n", | |
| " else:\n", | |
| " col = \"rgb(255,0,0)\"\n", | |
| " width = 1\n", | |
| " s[\"links\"].append({\"source\":name2Idx[e[1]], \"target\":name2Idx[e[0]], \"color\":col, \"width\":width})\n", | |
| " return json.dumps(s) \n", | |
| " n_json = generateD3JSONForG(G)\n", | |
| " vis_cell.set_js_var(\"n_json\", n_json)\n", | |
| " " | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [], | |
| "prompt_number": 10 | |
| }, | |
| { | |
| "cell_type": "markdown", | |
| "metadata": {}, | |
| "source": [ | |
| "Set up d3.js code for showing up the network around the word ``START``." | |
| ] | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "\n", | |
| "vis_display.js_code=[]\n", | |
| "\n", | |
| "set_g_json(\"START\")\n", | |
| "\n", | |
| "js = \"\"\"\n", | |
| "\n", | |
| "(function() {\n", | |
| "\n", | |
| "var plot_neighbor=function(json) {\n", | |
| " var w = 500,\n", | |
| " h = 400,\n", | |
| " fill = d3.scale.category10();\n", | |
| " var vis = d3.select(\"#plot_area #svg_display\")\n", | |
| " var force = d3.layout.force()\n", | |
| " .charge(-150)\n", | |
| " .linkDistance(10)\n", | |
| " .nodes(json.nodes)\n", | |
| " .links(json.links)\n", | |
| " .size([w, h])\n", | |
| " .start();\n", | |
| "\n", | |
| " var link = vis.selectAll(\"line.link\")\n", | |
| " .data(json.links)\n", | |
| " .enter().append(\"svg:line\")\n", | |
| " .attr(\"class\", \"link\")\n", | |
| " .style(\"stroke-width\", function(d) { return d.width; })\n", | |
| " .style(\"stroke\", function(d) { return d.color; })\n", | |
| " .attr(\"x1\", function(d) { return d.source.x; })\n", | |
| " .attr(\"y1\", function(d) { return d.source.y; })\n", | |
| " .attr(\"x2\", function(d) { return d.target.x; })\n", | |
| " .attr(\"y2\", function(d) { return d.target.y; });\n", | |
| "\n", | |
| " var node = vis.selectAll(\"circle.node\")\n", | |
| " .data(json.nodes)\n", | |
| " .enter().append(\"svg:circle\")\n", | |
| " .attr(\"class\", \"node\")\n", | |
| " .attr(\"cx\", function(d) { return d.x; })\n", | |
| " .attr(\"cy\", function(d) { return d.y; })\n", | |
| " .attr(\"r\", 8)\n", | |
| " .style(\"fill\", function(d) { return fill(d.group); })\n", | |
| " .call(force.drag);\n", | |
| "\n", | |
| " node.append(\"svg:title\")\n", | |
| " .text(function(d) { return d.name; });\n", | |
| "\n", | |
| " vis.style(\"opacity\", 1e-6)\n", | |
| " .transition()\n", | |
| " .duration(1000)\n", | |
| " .style(\"opacity\", 1);\n", | |
| "\n", | |
| " force.on(\"tick\", function() {\n", | |
| " link.attr(\"x1\", function(d) { return d.source.x; })\n", | |
| " .attr(\"y1\", function(d) { return d.source.y; })\n", | |
| " .attr(\"x2\", function(d) { return d.target.x; })\n", | |
| " .attr(\"y2\", function(d) { return d.target.y; });\n", | |
| "\n", | |
| " node.attr(\"cx\", function(d) { return d.x; })\n", | |
| " .attr(\"cy\", function(d) { return d.y; });\n", | |
| " });};\n", | |
| "var vc = IPython.vis_utils.name_to_viscell[\"plot_area\"];\n", | |
| "//alert(vc.data);\n", | |
| "var n_json=$.parseJSON(vc.data.n_json);\n", | |
| "//var n_json = vc.data.n_json;\n", | |
| "//alert(vc.data[\"n_json\"]);\n", | |
| "plot_neighbor(n_json)})()\n", | |
| "\"\"\"\n", | |
| "vis_display.attach_js_code(js)\n", | |
| "vis_display.refresh()\n" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "javascript": [ | |
| "(function(){var vc = IPython.vis_utils.name_to_viscell[\"plot_area\"];vc.data.n_json=\"{\\\"nodes\\\": [{\\\"group\\\": 1, \\\"name\\\": \\\"SMALT\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STADE\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAWN\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STANK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SWART\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SLART\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STATE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SOARY\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCANT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCALT\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STEPT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SKART\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SWARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SLARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCAUT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SWARF\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAUK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SNARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPIRT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SHARK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SLIRT\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERE\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAGY\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPART\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SNARY\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SHARN\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPARY\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STALE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SHARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SLANT\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STUNT\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STACY\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SMART\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SNARK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPARK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPORT\\\"}, {\\\"group\\\": 0, \\\"name\\\": \\\"BLART\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STURT\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAGE\\\"}, {\\\"group\\\": 4, \\\"name\\\": \\\"STARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCARY\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STORY\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAKE\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAUN\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERO\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SMARM\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCARP\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STENT\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERN\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCART\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STURK\\\"}, {\\\"group\\\": 4, \\\"name\\\": \\\"STARK\\\"}, {\\\"group\\\": 4, \\\"name\\\": \\\"STARN\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STORK\\\"}, {\\\"group\\\": 5, \\\"name\\\": \\\"START\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STANE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCARN\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SNURT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPURT\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAIN\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STALK\\\"}, {\\\"group\\\": 4, \\\"name\\\": \\\"STARY\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCARF\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SEARY\\\"}, {\\\"group\\\": 0, \\\"name\\\": \\\"OTARY\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAVE\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STIRK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SWARM\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SLAIT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPARM\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERT\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STACK\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERI\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERK\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STORE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SWARD\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPALT\\\"}, {\\\"group\\\": 0, \\\"name\\\": \\\"CLART\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SKIRT\\\"}, {\\\"group\\\": 0, \\\"name\\\": \\\"APART\\\"}], \\\"links\\\": [{\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 33, \\\"target\\\": 0, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 1, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 2, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 3, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 23, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 69, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 5, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 4, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 11, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 77, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 12, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 15, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 33, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 20, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 23, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 29, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 5, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 11, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 13, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 79, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 37, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 70, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 33, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 6, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 7, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 8, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 9, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 10, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 23, \\\"target\\\": 11, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 11, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 11, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 80, \\\"target\\\": 11, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 33, \\\"target\\\": 11, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 12, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 13, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 14, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 16, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 17, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 23, \\\"target\\\": 18, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 19, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 21, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 21, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 22, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 32, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 23, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 26, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 78, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 59, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 35, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 36, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 71, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 33, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 81, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 24, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 25, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 26, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 27, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 28, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 38, \\\"target\\\": 30, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 31, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 32, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 46, \\\"target\\\": 33, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 33, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 33, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 34, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 35, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 51, \\\"target\\\": 38, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 58, \\\"target\\\": 38, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 38, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 38, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 59, \\\"target\\\": 38, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 39, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 67, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 43, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 40, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 56, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 63, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 76, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 41, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 41, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 42, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 44, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 45, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 47, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 48, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 49, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 49, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 50, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 64, \\\"target\\\": 50, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 57, \\\"target\\\": 50, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 63, \\\"target\\\": 50, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 51, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 68, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 54, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 52, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 75, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 61, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 73, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 53, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 57, \\\"target\\\": 53, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 60, \\\"target\\\": 53, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 53, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 72, \\\"target\\\": 55, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 62, \\\"target\\\": 55, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 66, \\\"target\\\": 62, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 65, \\\"target\\\": 62, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 74, \\\"target\\\": 72, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 75, \\\"target\\\": 72, \\\"width\\\": 1}]}\";})()" | |
| ], | |
| "output_type": "display_data" | |
| }, | |
| { | |
| "javascript": [ | |
| "$('#plot_area').remove()" | |
| ], | |
| "output_type": "display_data" | |
| }, | |
| { | |
| "javascript": [ | |
| "IPython.vis_utils.insert_vis_cell(\"plot_area\"); \n", | |
| " $(\"#plot_area\").css(\"top\", \"0px\");\n", | |
| " $(\"#plot_area\").css(\"height\", \"520px\");\n", | |
| " $(\"#plot_area\").css(\"width\", \"500px\");\n", | |
| " $(\"#plot_area\").css(\"position\", \"absolute\");\n", | |
| " $(\"#plot_area\").css(\"border\", \"9px groove\");\n", | |
| " $(\"#plot_area\").css(\"background-color\", \"rgba(200,200,200,0.5)\");\n", | |
| " $(\"#plot_area\").css(\"left\", \"850px\");" | |
| ], | |
| "output_type": "display_data" | |
| }, | |
| { | |
| "javascript": [ | |
| "(function(){var vc = IPython.vis_utils.name_to_viscell[\"plot_area\"];vc.data.n_json=\"{\\\"nodes\\\": [{\\\"group\\\": 1, \\\"name\\\": \\\"SMALT\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STADE\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAWN\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STANK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SWART\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SLART\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STATE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SOARY\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCANT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCALT\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STEPT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SKART\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SWARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SLARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCAUT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SWARF\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAUK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SNARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPIRT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SHARK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SLIRT\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERE\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAGY\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPART\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SNARY\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SHARN\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPARY\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STALE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SHARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SLANT\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STUNT\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STACY\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SMART\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SNARK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPARK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPORT\\\"}, {\\\"group\\\": 0, \\\"name\\\": \\\"BLART\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STURT\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAGE\\\"}, {\\\"group\\\": 4, \\\"name\\\": \\\"STARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCARY\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STORY\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAKE\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAUN\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERO\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SMARM\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCARP\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STENT\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERN\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCART\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STURK\\\"}, {\\\"group\\\": 4, \\\"name\\\": \\\"STARK\\\"}, {\\\"group\\\": 4, \\\"name\\\": \\\"STARN\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STORK\\\"}, {\\\"group\\\": 5, \\\"name\\\": \\\"START\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STANE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCARN\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SNURT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPURT\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAIN\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STALK\\\"}, {\\\"group\\\": 4, \\\"name\\\": \\\"STARY\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCARF\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SEARY\\\"}, {\\\"group\\\": 0, \\\"name\\\": \\\"OTARY\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAVE\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STIRK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SWARM\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SLAIT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPARM\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERT\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STACK\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERI\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERK\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STORE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SWARD\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPALT\\\"}, {\\\"group\\\": 0, \\\"name\\\": \\\"CLART\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SKIRT\\\"}, {\\\"group\\\": 0, \\\"name\\\": \\\"APART\\\"}], \\\"links\\\": [{\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 33, \\\"target\\\": 0, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 1, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 2, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 3, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 23, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 69, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 5, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 4, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 11, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 77, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 12, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 15, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 33, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 20, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 23, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 29, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 5, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 11, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 13, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 79, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 37, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 70, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 33, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 6, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 7, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 8, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 9, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 10, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 23, \\\"target\\\": 11, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 11, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 11, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 80, \\\"target\\\": 11, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 33, \\\"target\\\": 11, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 12, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 13, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 14, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 16, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 17, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 23, \\\"target\\\": 18, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 19, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 21, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 21, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 22, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 32, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 23, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 26, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 78, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 59, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 35, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 36, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 71, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 33, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 81, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 24, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 25, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 26, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 27, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 28, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 38, \\\"target\\\": 30, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 31, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 32, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 46, \\\"target\\\": 33, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 33, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 33, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 34, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 35, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 51, \\\"target\\\": 38, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 58, \\\"target\\\": 38, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 38, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 38, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 59, \\\"target\\\": 38, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 39, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 67, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 43, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 40, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 56, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 63, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 76, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 41, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 41, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 42, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 44, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 45, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 47, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 48, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 49, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 49, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 50, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 64, \\\"target\\\": 50, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 57, \\\"target\\\": 50, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 63, \\\"target\\\": 50, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 51, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 68, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 54, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 52, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 75, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 61, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 73, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 53, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 57, \\\"target\\\": 53, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 60, \\\"target\\\": 53, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 53, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 72, \\\"target\\\": 55, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 62, \\\"target\\\": 55, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 66, \\\"target\\\": 62, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 65, \\\"target\\\": 62, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 74, \\\"target\\\": 72, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 75, \\\"target\\\": 72, \\\"width\\\": 1}]}\";})()" | |
| ], | |
| "output_type": "display_data" | |
| }, | |
| { | |
| "javascript": [ | |
| "\n", | |
| "\n", | |
| "$(\"#plot_area\").append(\"<svg id='svg_display'></svg>\"); \n", | |
| " $(\"#svg_display\").css(\"width\", \"500px\");\n", | |
| " $(\"#svg_display\").css(\"border\", \"2px solid\");\n", | |
| " $(\"#svg_display\").css(\"height\", \"445px\");\n", | |
| "\n", | |
| "\n", | |
| "\n", | |
| "(function() {\n", | |
| "\n", | |
| "var plot_neighbor=function(json) {\n", | |
| " var w = 500,\n", | |
| " h = 400,\n", | |
| " fill = d3.scale.category10();\n", | |
| " var vis = d3.select(\"#plot_area #svg_display\")\n", | |
| " var force = d3.layout.force()\n", | |
| " .charge(-150)\n", | |
| " .linkDistance(10)\n", | |
| " .nodes(json.nodes)\n", | |
| " .links(json.links)\n", | |
| " .size([w, h])\n", | |
| " .start();\n", | |
| "\n", | |
| " var link = vis.selectAll(\"line.link\")\n", | |
| " .data(json.links)\n", | |
| " .enter().append(\"svg:line\")\n", | |
| " .attr(\"class\", \"link\")\n", | |
| " .style(\"stroke-width\", function(d) { return d.width; })\n", | |
| " .style(\"stroke\", function(d) { return d.color; })\n", | |
| " .attr(\"x1\", function(d) { return d.source.x; })\n", | |
| " .attr(\"y1\", function(d) { return d.source.y; })\n", | |
| " .attr(\"x2\", function(d) { return d.target.x; })\n", | |
| " .attr(\"y2\", function(d) { return d.target.y; });\n", | |
| "\n", | |
| " var node = vis.selectAll(\"circle.node\")\n", | |
| " .data(json.nodes)\n", | |
| " .enter().append(\"svg:circle\")\n", | |
| " .attr(\"class\", \"node\")\n", | |
| " .attr(\"cx\", function(d) { return d.x; })\n", | |
| " .attr(\"cy\", function(d) { return d.y; })\n", | |
| " .attr(\"r\", 8)\n", | |
| " .style(\"fill\", function(d) { return fill(d.group); })\n", | |
| " .call(force.drag);\n", | |
| "\n", | |
| " node.append(\"svg:title\")\n", | |
| " .text(function(d) { return d.name; });\n", | |
| "\n", | |
| " vis.style(\"opacity\", 1e-6)\n", | |
| " .transition()\n", | |
| " .duration(1000)\n", | |
| " .style(\"opacity\", 1);\n", | |
| "\n", | |
| " force.on(\"tick\", function() {\n", | |
| " link.attr(\"x1\", function(d) { return d.source.x; })\n", | |
| " .attr(\"y1\", function(d) { return d.source.y; })\n", | |
| " .attr(\"x2\", function(d) { return d.target.x; })\n", | |
| " .attr(\"y2\", function(d) { return d.target.y; });\n", | |
| "\n", | |
| " node.attr(\"cx\", function(d) { return d.x; })\n", | |
| " .attr(\"cy\", function(d) { return d.y; });\n", | |
| " });};\n", | |
| "var vc = IPython.vis_utils.name_to_viscell[\"plot_area\"];\n", | |
| "//alert(vc.data);\n", | |
| "var n_json=$.parseJSON(vc.data.n_json);\n", | |
| "//var n_json = vc.data.n_json;\n", | |
| "//alert(vc.data[\"n_json\"]);\n", | |
| "plot_neighbor(n_json)})()\n" | |
| ], | |
| "output_type": "display_data" | |
| } | |
| ], | |
| "prompt_number": 11 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "vis_display.hide()" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "javascript": [ | |
| "$(\"#plot_area\").css(\"visibility\",\"hidden\")" | |
| ], | |
| "output_type": "display_data" | |
| } | |
| ], | |
| "prompt_number": 12 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "vis_display.show()" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "javascript": [ | |
| "$(\"#plot_area\").css(\"visibility\",\"visible\")" | |
| ], | |
| "output_type": "display_data" | |
| } | |
| ], | |
| "prompt_number": 13 | |
| }, | |
| { | |
| "cell_type": "code", | |
| "collapsed": false, | |
| "input": [ | |
| "def show_neighbors(w):\n", | |
| " vis.run_js('$(\"#svg_display *\").remove();')\n", | |
| " set_g_json(w)\n", | |
| " for jc in vis_display.js_code:\n", | |
| " vis.run_js(jc)\n", | |
| " \n", | |
| " \n", | |
| "## create a test input text box\n", | |
| "input_style = {\"width\":\"240px\"}\n", | |
| "tb = vis.InputWidget(name = \"input_1\",\n", | |
| " parent = \"plot_area\",\n", | |
| " style = input_style,\n", | |
| " value = \"START\",\n", | |
| " vis = vis_display)\n", | |
| "\n", | |
| "def onchange(self, *argv, **kwargv):\n", | |
| " self.update_value()\n", | |
| " \n", | |
| "vis.set_action(tb, \"onchange\", onchange)\n", | |
| "\n", | |
| "button_style = {\"width\":\"120px\"}\n", | |
| "b = vis.ButtonWidget(name=\"button\", \n", | |
| " parent=\"plot_area\", \n", | |
| " style=button_style, \n", | |
| " text=\"show neighbors\",\n", | |
| " vis = vis_display)\n", | |
| "b.argv = [tb]\n", | |
| "def onclick(self, *argv, **kwargv):\n", | |
| " self.text = argv[0].value\n", | |
| " show_neighbors(self.text)\n", | |
| " \n", | |
| "vis.set_action(b, \"onclick\", onclick, \"argv\")\n", | |
| "\n", | |
| "\n", | |
| "button_style = {\"width\":\"120px\"}\n", | |
| "b2 = vis.ButtonWidget(name=\"button2\", \n", | |
| " parent=\"plot_area\", \n", | |
| " style=button_style, \n", | |
| " text=\"close\",\n", | |
| " vis = vis_display)\n", | |
| "def onclick(self, *argv, **kwargv):\n", | |
| " vis_display.remove()\n", | |
| " \n", | |
| "vis.set_action(b2, \"onclick\", onclick)\n", | |
| "\n", | |
| "vis_display.refresh()" | |
| ], | |
| "language": "python", | |
| "metadata": {}, | |
| "outputs": [ | |
| { | |
| "javascript": [ | |
| "$('#plot_area').remove()" | |
| ], | |
| "output_type": "display_data" | |
| }, | |
| { | |
| "javascript": [ | |
| "IPython.vis_utils.insert_vis_cell(\"plot_area\"); \n", | |
| " $(\"#plot_area\").css(\"top\", \"0px\");\n", | |
| " $(\"#plot_area\").css(\"height\", \"520px\");\n", | |
| " $(\"#plot_area\").css(\"width\", \"500px\");\n", | |
| " $(\"#plot_area\").css(\"position\", \"absolute\");\n", | |
| " $(\"#plot_area\").css(\"border\", \"9px groove\");\n", | |
| " $(\"#plot_area\").css(\"background-color\", \"rgba(200,200,200,0.5)\");\n", | |
| " $(\"#plot_area\").css(\"left\", \"850px\");" | |
| ], | |
| "output_type": "display_data" | |
| }, | |
| { | |
| "javascript": [ | |
| "(function(){var vc = IPython.vis_utils.name_to_viscell[\"plot_area\"];vc.data.n_json=\"{\\\"nodes\\\": [{\\\"group\\\": 1, \\\"name\\\": \\\"SMALT\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STADE\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAWN\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STANK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SWART\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SLART\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STATE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SOARY\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCANT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCALT\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STEPT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SKART\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SWARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SLARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCAUT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SWARF\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAUK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SNARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPIRT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SHARK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SLIRT\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERE\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAGY\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPART\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SNARY\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SHARN\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPARY\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STALE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SHARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SLANT\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STUNT\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STACY\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SMART\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SNARK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPARK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPORT\\\"}, {\\\"group\\\": 0, \\\"name\\\": \\\"BLART\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STURT\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAGE\\\"}, {\\\"group\\\": 4, \\\"name\\\": \\\"STARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCARY\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STORY\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAKE\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAUN\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERO\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SMARM\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCARP\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STENT\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERN\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCART\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STURK\\\"}, {\\\"group\\\": 4, \\\"name\\\": \\\"STARK\\\"}, {\\\"group\\\": 4, \\\"name\\\": \\\"STARN\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STORK\\\"}, {\\\"group\\\": 5, \\\"name\\\": \\\"START\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STANE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCARN\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SNURT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPURT\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAIN\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STALK\\\"}, {\\\"group\\\": 4, \\\"name\\\": \\\"STARY\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCARE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SCARF\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SEARY\\\"}, {\\\"group\\\": 0, \\\"name\\\": \\\"OTARY\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STAVE\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STIRK\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SWARM\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SLAIT\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPARM\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERT\\\"}, {\\\"group\\\": 3, \\\"name\\\": \\\"STACK\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERI\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STERK\\\"}, {\\\"group\\\": 2, \\\"name\\\": \\\"STORE\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SWARD\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SPALT\\\"}, {\\\"group\\\": 0, \\\"name\\\": \\\"CLART\\\"}, {\\\"group\\\": 1, \\\"name\\\": \\\"SKIRT\\\"}, {\\\"group\\\": 0, \\\"name\\\": \\\"APART\\\"}], \\\"links\\\": [{\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 33, \\\"target\\\": 0, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 1, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 2, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 3, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 23, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 69, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 5, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 4, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 11, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 77, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 12, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 15, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 33, \\\"target\\\": 4, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 20, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 23, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 29, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 5, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 11, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 13, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 79, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 37, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 70, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 33, \\\"target\\\": 5, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 6, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 7, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 8, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 9, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 10, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 23, \\\"target\\\": 11, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 11, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 11, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 80, \\\"target\\\": 11, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 33, \\\"target\\\": 11, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 12, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 13, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 14, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 16, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 17, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 23, \\\"target\\\": 18, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 19, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 21, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 21, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 22, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 32, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 23, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 26, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 78, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 59, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 35, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 36, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 71, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 33, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 81, \\\"target\\\": 23, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 24, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 25, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 26, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 27, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 28, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 38, \\\"target\\\": 30, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 31, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 32, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 46, \\\"target\\\": 33, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 33, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 33, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 34, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 35, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 51, \\\"target\\\": 38, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 58, \\\"target\\\": 38, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 38, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 38, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 59, \\\"target\\\": 38, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 40, \\\"target\\\": 39, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 67, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 43, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 40, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 56, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 63, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 76, \\\"target\\\": 40, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 41, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 41, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 42, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 44, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 45, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 50, \\\"target\\\": 47, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 48, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 49, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 72, \\\"target\\\": 49, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 50, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 64, \\\"target\\\": 50, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 57, \\\"target\\\": 50, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 63, \\\"target\\\": 50, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 52, \\\"target\\\": 51, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 68, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 53, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 54, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 52, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 75, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 61, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 73, \\\"target\\\": 52, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 55, \\\"target\\\": 53, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 57, \\\"target\\\": 53, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 60, \\\"target\\\": 53, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 62, \\\"target\\\": 53, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 72, \\\"target\\\": 55, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(0,0,255)\\\", \\\"source\\\": 62, \\\"target\\\": 55, \\\"width\\\": 3}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 66, \\\"target\\\": 62, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 65, \\\"target\\\": 62, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 74, \\\"target\\\": 72, \\\"width\\\": 1}, {\\\"color\\\": \\\"rgb(255,0,0)\\\", \\\"source\\\": 75, \\\"target\\\": 72, \\\"width\\\": 1}]}\";})()" | |
| ], | |
| "output_type": "display_data" | |
| }, | |
| { | |
| "javascript": [ | |
| "\n", | |
| "\n", | |
| "$(\"#plot_area\").append(\"<svg id='svg_display'></svg>\"); \n", | |
| " $(\"#svg_display\").css(\"width\", \"500px\");\n", | |
| " $(\"#svg_display\").css(\"border\", \"2px solid\");\n", | |
| " $(\"#svg_display\").css(\"height\", \"445px\");\n", | |
| "\n", | |
| "$(\"#plot_area\").append(\"<input id='input_1' value='START'></input>\"); \n", | |
| " $(\"#input_1\").css(\"width\", \"240px\");( function () {$(\"#input_1\")[0].onchange= function() {var vc = IPython.vis_utils.name_to_viscell[\"plot_area\"]; var vis_code = \"try:\\n _w = _vis.get_widget_by_name('input_1')\\nexcept NameError:\\n import visutils as _vis\\n _w = _vis.get_widget_by_name('input_1')\\n_w.onchange()\";vc.execute_py(vis_code);} } )();\n", | |
| "\n", | |
| "$(\"#plot_area\").append(\"<button id='button'>show neighbors</button>\"); \n", | |
| " $(\"#button\").css(\"width\", \"120px\");( function () {$(\"#button\")[0].onclick= function() {var vc = IPython.vis_utils.name_to_viscell[\"plot_area\"]; var vis_code = \"try:\\n _w = _vis.get_widget_by_name('button')\\nexcept NameError:\\n import visutils as _vis\\n _w = _vis.get_widget_by_name('button')\\n_w.onclick(*_w.argv)\";vc.execute_py(vis_code);} } )();\n", | |
| "\n", | |
| "$(\"#plot_area\").append(\"<button id='button2'>close</button>\"); \n", | |
| " $(\"#button2\").css(\"width\", \"120px\");( function () {$(\"#button2\")[0].onclick= function() {var vc = IPython.vis_utils.name_to_viscell[\"plot_area\"]; var vis_code = \"try:\\n _w = _vis.get_widget_by_name('button2')\\nexcept NameError:\\n import visutils as _vis\\n _w = _vis.get_widget_by_name('button2')\\n_w.onclick()\";vc.execute_py(vis_code);} } )();\n", | |
| "\n", | |
| "\n", | |
| "\n", | |
| "(function() {\n", | |
| "\n", | |
| "var plot_neighbor=function(json) {\n", | |
| " var w = 500,\n", | |
| " h = 400,\n", | |
| " fill = d3.scale.category10();\n", | |
| " var vis = d3.select(\"#plot_area #svg_display\")\n", | |
| " var force = d3.layout.force()\n", | |
| " .charge(-150)\n", | |
| " .linkDistance(10)\n", | |
| " .nodes(json.nodes)\n", | |
| " .links(json.links)\n", | |
| " .size([w, h])\n", | |
| " .start();\n", | |
| "\n", | |
| " var link = vis.selectAll(\"line.link\")\n", | |
| " .data(json.links)\n", | |
| " .enter().append(\"svg:line\")\n", | |
| " .attr(\"class\", \"link\")\n", | |
| " .style(\"stroke-width\", function(d) { return d.width; })\n", | |
| " .style(\"stroke\", function(d) { return d.color; })\n", | |
| " .attr(\"x1\", function(d) { return d.source.x; })\n", | |
| " .attr(\"y1\", function(d) { return d.source.y; })\n", | |
| " .attr(\"x2\", function(d) { return d.target.x; })\n", | |
| " .attr(\"y2\", function(d) { return d.target.y; });\n", | |
| "\n", | |
| " var node = vis.selectAll(\"circle.node\")\n", | |
| " .data(json.nodes)\n", | |
| " .enter().append(\"svg:circle\")\n", | |
| " .attr(\"class\", \"node\")\n", | |
| " .attr(\"cx\", function(d) { return d.x; })\n", | |
| " .attr(\"cy\", function(d) { return d.y; })\n", | |
| " .attr(\"r\", 8)\n", | |
| " .style(\"fill\", function(d) { return fill(d.group); })\n", | |
| " .call(force.drag);\n", | |
| "\n", | |
| " node.append(\"svg:title\")\n", | |
| " .text(function(d) { return d.name; });\n", | |
| "\n", | |
| " vis.style(\"opacity\", 1e-6)\n", | |
| " .transition()\n", | |
| " .duration(1000)\n", | |
| " .style(\"opacity\", 1);\n", | |
| "\n", | |
| " force.on(\"tick\", function() {\n", | |
| " link.attr(\"x1\", function(d) { return d.source.x; })\n", | |
| " .attr(\"y1\", function(d) { return d.source.y; })\n", | |
| " .attr(\"x2\", function(d) { return d.target.x; })\n", | |
| " .attr(\"y2\", function(d) { return d.target.y; });\n", | |
| "\n", | |
| " node.attr(\"cx\", function(d) { return d.x; })\n", | |
| " .attr(\"cy\", function(d) { return d.y; });\n", | |
| " });};\n", | |
| "var vc = IPython.vis_utils.name_to_viscell[\"plot_area\"];\n", | |
| "//alert(vc.data);\n", | |
| "var n_json=$.parseJSON(vc.data.n_json);\n", | |
| "//var n_json = vc.data.n_json;\n", | |
| "//alert(vc.data[\"n_json\"]);\n", | |
| "plot_neighbor(n_json)})()\n" | |
| ], | |
| "output_type": "display_data" | |
| } | |
| ], | |
| "prompt_number": 14 | |
| } | |
| ], | |
| "metadata": {} | |
| } | |
| ] | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Clipped From
Thanks!