{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "Week13_Assignment.ipynb",
      "provenance": [],
      "collapsed_sections": []
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    }
  },
  "cells": [
    {
      "cell_type": "code",
      "metadata": {
        "id": "-c2YnvvCei8k",
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "outputId": "19957757-adac-4510-868d-068f17bfc75e"
      },
      "source": [
        "!pip install dimcli networkx pyvis -U --quiet"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "\u001b[K     |████████████████████████████████| 307kB 8.6MB/s \n",
            "\u001b[K     |████████████████████████████████| 51kB 4.3MB/s \n",
            "\u001b[?25h"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 299
        },
        "id": "sDZ3OTw1_KN0",
        "outputId": "53042041-cc49-4147-8240-b7b66dbd3e96"
      },
      "source": [
        "import networkx as nx\n",
        "from pyvis import network as net\n",
        "import pyvis\n",
        "import pandas as pd\n",
        "import matplotlib.pyplot as plt\n",
        "import numpy as np\n",
        "import scipy\n",
        "from dimcli.core.extras import NetworkViz\n",
        "\n",
        "lrst = pd.DataFrame({'class': ['Math', 'Math', 'Math', 'Math','English', 'English', 'English',  'PE', 'PE', 'PE', 'PE', 'History', 'History', 'History', 'History', 'History'],\n",
        "                    'name': ['Carole ', 'Wood', 'Terrence ', 'Bowen','Anne', 'Singleton', 'Yvette','Edwards', 'Terrence ', 'Foster', 'Austin ','Montgomery', 'Lorena', 'Yvette', 'Kirk', 'Alexander']})\n",
        "lrst.head(10)"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "application/vnd.google.colaboratory.module+javascript": "\n      import \"https://ssl.gstatic.com/colaboratory/data_table/a6224c040fa35dcf/data_table.js\";\n\n      window.createDataTable({\n        data: [[{\n            'v': 0,\n            'f': \"0\",\n        },\n\"Math\",\n\"Carole \"],\n [{\n            'v': 1,\n            'f': \"1\",\n        },\n\"Math\",\n\"Wood\"],\n [{\n            'v': 2,\n            'f': \"2\",\n        },\n\"Math\",\n\"Terrence \"],\n [{\n            'v': 3,\n            'f': \"3\",\n        },\n\"Math\",\n\"Bowen\"],\n [{\n            'v': 4,\n            'f': \"4\",\n        },\n\"English\",\n\"Anne\"],\n [{\n            'v': 5,\n            'f': \"5\",\n        },\n\"English\",\n\"Singleton\"],\n [{\n            'v': 6,\n            'f': \"6\",\n        },\n\"English\",\n\"Yvette\"],\n [{\n            'v': 7,\n            'f': \"7\",\n        },\n\"PE\",\n\"Edwards\"],\n [{\n            'v': 8,\n            'f': \"8\",\n        },\n\"PE\",\n\"Terrence \"],\n [{\n            'v': 9,\n            'f': \"9\",\n        },\n\"PE\",\n\"Foster\"]],\n        columns: [[\"number\", \"index\"], [\"string\", \"class\"], [\"string\", \"name\"]],\n        columnOptions: [{\"width\": \"1px\", \"className\": \"index_column\"}],\n        rowsPerPage: 25,\n        helpUrl: \"https://colab.research.google.com/notebooks/data_table.ipynb\",\n        suppressOutputScrolling: true,\n        minimumWidth: undefined,\n      });\n    ",
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>class</th>\n",
              "      <th>name</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Math</td>\n",
              "      <td>Carole</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>Math</td>\n",
              "      <td>Wood</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>Math</td>\n",
              "      <td>Terrence</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>Math</td>\n",
              "      <td>Bowen</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>English</td>\n",
              "      <td>Anne</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>English</td>\n",
              "      <td>Singleton</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>English</td>\n",
              "      <td>Yvette</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>7</th>\n",
              "      <td>PE</td>\n",
              "      <td>Edwards</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>8</th>\n",
              "      <td>PE</td>\n",
              "      <td>Terrence</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>9</th>\n",
              "      <td>PE</td>\n",
              "      <td>Foster</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "     class       name\n",
              "0     Math    Carole \n",
              "1     Math       Wood\n",
              "2     Math  Terrence \n",
              "3     Math      Bowen\n",
              "4  English       Anne\n",
              "5  English  Singleton\n",
              "6  English     Yvette\n",
              "7       PE    Edwards\n",
              "8       PE  Terrence \n",
              "9       PE     Foster"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 5
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "1B59dOs5AS9e",
        "outputId": "436b0e77-027a-4110-a15a-84db35599e75"
      },
      "source": [
        "df = nx.from_pandas_edgelist(lrst, source = 'class', target = 'name')\n",
        "data = nx.adjacency_matrix(df)\n",
        "print(data.todense())"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "[[0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
            " [1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
            " [1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
            " [1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0]\n",
            " [1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
            " [0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0]\n",
            " [0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0]\n",
            " [0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0]\n",
            " [0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0]\n",
            " [0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0]\n",
            " [0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0]\n",
            " [0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0]\n",
            " [0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0]\n",
            " [0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1]\n",
            " [0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0]\n",
            " [0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0]\n",
            " [0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0]\n",
            " [0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0]]\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 383
        },
        "id": "AZi4mVnLAopM",
        "outputId": "c55752ff-ce23-4c6b-98e5-bb4fb52c062d"
      },
      "source": [
        "nodes = list(df.nodes())\n",
        "documents = lrst['class'].unique().tolist()\n",
        "names = lrst['name'].unique().tolist()\n",
        "\n",
        "row_idx = []\n",
        "for name in names:\n",
        "      temp = np.where(np.array(nodes) == name)\n",
        "      row_idx.append(temp[0][0])\n",
        "\n",
        "col_idx = []\n",
        "for document in documents:\n",
        "      temp = np.where(np.array(nodes) == document)\n",
        "      col_idx.append(temp[0][0])\n",
        "\n",
        "column_names = lrst['class'].unique().tolist()\n",
        "doc_matrix = pd.DataFrame(data[np.ix_(row_idx, col_idx)].todense(), columns = column_names)\n",
        "doc_matrix.insert(0, 'name', pd.Series(names))        \n",
        "doc_matrix"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "application/vnd.google.colaboratory.module+javascript": "\n      import \"https://ssl.gstatic.com/colaboratory/data_table/a6224c040fa35dcf/data_table.js\";\n\n      window.createDataTable({\n        data: [[{\n            'v': 0,\n            'f': \"0\",\n        },\n\"Carole \",\n{\n            'v': 1,\n            'f': \"1\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        }],\n [{\n            'v': 1,\n            'f': \"1\",\n        },\n\"Wood\",\n{\n            'v': 1,\n            'f': \"1\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        }],\n [{\n            'v': 2,\n            'f': \"2\",\n        },\n\"Terrence \",\n{\n            'v': 1,\n            'f': \"1\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 1,\n            'f': \"1\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        }],\n [{\n            'v': 3,\n            'f': \"3\",\n        },\n\"Bowen\",\n{\n            'v': 1,\n            'f': \"1\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        }],\n [{\n            'v': 4,\n            'f': \"4\",\n        },\n\"Anne\",\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 1,\n            'f': \"1\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        }],\n [{\n            'v': 5,\n            'f': \"5\",\n        },\n\"Singleton\",\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 1,\n            'f': \"1\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        }],\n [{\n            'v': 6,\n            'f': \"6\",\n        },\n\"Yvette\",\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 1,\n            'f': \"1\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 1,\n            'f': \"1\",\n        }],\n [{\n            'v': 7,\n            'f': \"7\",\n        },\n\"Edwards\",\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 1,\n            'f': \"1\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        }],\n [{\n            'v': 8,\n            'f': \"8\",\n        },\n\"Foster\",\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 1,\n            'f': \"1\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        }],\n [{\n            'v': 9,\n            'f': \"9\",\n        },\n\"Austin \",\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 1,\n            'f': \"1\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        }],\n [{\n            'v': 10,\n            'f': \"10\",\n        },\n\"Montgomery\",\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 1,\n            'f': \"1\",\n        }],\n [{\n            'v': 11,\n            'f': \"11\",\n        },\n\"Lorena\",\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 1,\n            'f': \"1\",\n        }],\n [{\n            'v': 12,\n            'f': \"12\",\n        },\n\"Kirk\",\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 1,\n            'f': \"1\",\n        }],\n [{\n            'v': 13,\n            'f': \"13\",\n        },\n\"Alexander\",\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 0,\n            'f': \"0\",\n        },\n{\n            'v': 1,\n            'f': \"1\",\n        }]],\n        columns: [[\"number\", \"index\"], [\"string\", \"name\"], [\"number\", \"Math\"], [\"number\", \"English\"], [\"number\", \"PE\"], [\"number\", \"History\"]],\n        columnOptions: [{\"width\": \"1px\", \"className\": \"index_column\"}],\n        rowsPerPage: 25,\n        helpUrl: \"https://colab.research.google.com/notebooks/data_table.ipynb\",\n        suppressOutputScrolling: true,\n        minimumWidth: undefined,\n      });\n    ",
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>name</th>\n",
              "      <th>Math</th>\n",
              "      <th>English</th>\n",
              "      <th>PE</th>\n",
              "      <th>History</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Carole</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>Wood</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>Terrence</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>Bowen</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>Anne</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>5</th>\n",
              "      <td>Singleton</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>6</th>\n",
              "      <td>Yvette</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>7</th>\n",
              "      <td>Edwards</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>8</th>\n",
              "      <td>Foster</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>9</th>\n",
              "      <td>Austin</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "      <td>0</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>10</th>\n",
              "      <td>Montgomery</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>11</th>\n",
              "      <td>Lorena</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>12</th>\n",
              "      <td>Kirk</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>13</th>\n",
              "      <td>Alexander</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>0</td>\n",
              "      <td>1</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "          name  Math  English  PE  History\n",
              "0      Carole      1        0   0        0\n",
              "1         Wood     1        0   0        0\n",
              "2    Terrence      1        0   1        0\n",
              "3        Bowen     1        0   0        0\n",
              "4         Anne     0        1   0        0\n",
              "5    Singleton     0        1   0        0\n",
              "6       Yvette     0        1   0        1\n",
              "7      Edwards     0        0   1        0\n",
              "8       Foster     0        0   1        0\n",
              "9      Austin      0        0   1        0\n",
              "10  Montgomery     0        0   0        1\n",
              "11      Lorena     0        0   0        1\n",
              "12        Kirk     0        0   0        1\n",
              "13   Alexander     0        0   0        1"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 7
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "A1jAbNVsKOrB",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 576
        },
        "outputId": "39dbcf2e-ad14-498a-9636-7816e50aee05"
      },
      "source": [
        "G = NetworkViz(notebook=True)\n",
        "G.from_nx(df)\n",
        "G.show(\"example.html\")"
      ],
      "execution_count": null,
      "outputs": [
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<html>\n",
              "<head>\n",
              "<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis.css\" type=\"text/css\" />\n",
              "<script type=\"text/javascript\" src=\"https://cdnjs.cloudflare.com/ajax/libs/vis/4.16.1/vis-network.min.js\"> </script>\n",
              "<center>\n",
              "<h1>None</h1>\n",
              "</center>\n",
              "\n",
              "<!-- <link rel=\"stylesheet\" href=\"../node_modules/vis/dist/vis.min.css\" type=\"text/css\" />\n",
              "<script type=\"text/javascript\" src=\"../node_modules/vis/dist/vis.js\"> </script>-->\n",
              "\n",
              "<style type=\"text/css\">\n",
              "\n",
              "        #mynetwork {\n",
              "            width: 500px;\n",
              "            height: 500px;\n",
              "            background-color: #ffffff;\n",
              "            border: 1px solid lightgray;\n",
              "            position: relative;\n",
              "            float: left;\n",
              "        }\n",
              "\n",
              "        \n",
              "\n",
              "        \n",
              "\n",
              "        \n",
              "</style>\n",
              "\n",
              "</head>\n",
              "\n",
              "<body>\n",
              "<div id = \"mynetwork\"></div>\n",
              "\n",
              "\n",
              "<script type=\"text/javascript\">\n",
              "\n",
              "    // initialize global variables.\n",
              "    var edges;\n",
              "    var nodes;\n",
              "    var network; \n",
              "    var container;\n",
              "    var options, data;\n",
              "\n",
              "    \n",
              "    // This method is responsible for drawing the graph, returns the drawn network\n",
              "    function drawGraph() {\n",
              "        var container = document.getElementById('mynetwork');\n",
              "        \n",
              "        \n",
              "\n",
              "        // parsing and collecting nodes and edges from the python\n",
              "        nodes = new vis.DataSet([{\"id\": \"Math\", \"label\": \"Math\", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"Carole \", \"label\": \"Carole \", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"Wood\", \"label\": \"Wood\", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"Terrence \", \"label\": \"Terrence \", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"Bowen\", \"label\": \"Bowen\", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"PE\", \"label\": \"PE\", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"English\", \"label\": \"English\", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"Anne\", \"label\": \"Anne\", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"Singleton\", \"label\": \"Singleton\", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"Yvette\", \"label\": \"Yvette\", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"History\", \"label\": \"History\", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"Edwards\", \"label\": \"Edwards\", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"Foster\", \"label\": \"Foster\", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"Austin \", \"label\": \"Austin \", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"Montgomery\", \"label\": \"Montgomery\", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"Lorena\", \"label\": \"Lorena\", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"Kirk\", \"label\": \"Kirk\", \"shape\": \"dot\", \"size\": 10}, {\"id\": \"Alexander\", \"label\": \"Alexander\", \"shape\": \"dot\", \"size\": 10}]);\n",
              "        edges = new vis.DataSet([{\"from\": \"Math\", \"to\": \"Carole \", \"weight\": 1}, {\"from\": \"Math\", \"to\": \"Wood\", \"weight\": 1}, {\"from\": \"Math\", \"to\": \"Terrence \", \"weight\": 1}, {\"from\": \"Math\", \"to\": \"Bowen\", \"weight\": 1}, {\"from\": \"Terrence \", \"to\": \"PE\", \"weight\": 1}, {\"from\": \"English\", \"to\": \"Anne\", \"weight\": 1}, {\"from\": \"English\", \"to\": \"Singleton\", \"weight\": 1}, {\"from\": \"English\", \"to\": \"Yvette\", \"weight\": 1}, {\"from\": \"Yvette\", \"to\": \"History\", \"weight\": 1}, {\"from\": \"PE\", \"to\": \"Edwards\", \"weight\": 1}, {\"from\": \"PE\", \"to\": \"Foster\", \"weight\": 1}, {\"from\": \"PE\", \"to\": \"Austin \", \"weight\": 1}, {\"from\": \"History\", \"to\": \"Montgomery\", \"weight\": 1}, {\"from\": \"History\", \"to\": \"Lorena\", \"weight\": 1}, {\"from\": \"History\", \"to\": \"Kirk\", \"weight\": 1}, {\"from\": \"History\", \"to\": \"Alexander\", \"weight\": 1}]);\n",
              "\n",
              "        // adding nodes and edges to the graph\n",
              "        data = {nodes: nodes, edges: edges};\n",
              "\n",
              "        var options = {\n",
              "    \"configure\": {\n",
              "        \"enabled\": false\n",
              "    },\n",
              "    \"edges\": {\n",
              "        \"color\": {\n",
              "            \"inherit\": true\n",
              "        },\n",
              "        \"smooth\": {\n",
              "            \"enabled\": false,\n",
              "            \"type\": \"continuous\"\n",
              "        }\n",
              "    },\n",
              "    \"interaction\": {\n",
              "        \"dragNodes\": true,\n",
              "        \"hideEdgesOnDrag\": false,\n",
              "        \"hideNodesOnDrag\": false\n",
              "    },\n",
              "    \"physics\": {\n",
              "        \"enabled\": true,\n",
              "        \"stabilization\": {\n",
              "            \"enabled\": true,\n",
              "            \"fit\": true,\n",
              "            \"iterations\": 1000,\n",
              "            \"onlyDynamicEdges\": false,\n",
              "            \"updateInterval\": 50\n",
              "        }\n",
              "    }\n",
              "};\n",
              "        \n",
              "        \n",
              "\n",
              "        \n",
              "\n",
              "        network = new vis.Network(container, data, options);\n",
              "\n",
              "        \n",
              "\n",
              "\n",
              "        \n",
              "\n",
              "        return network;\n",
              "\n",
              "    }\n",
              "\n",
              "    drawGraph();\n",
              "\n",
              "</script>\n",
              "</body>\n",
              "</html>"
            ],
            "text/plain": [
              "<IPython.core.display.HTML object>"
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 8
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Ih6-1VeHBzzv"
      },
      "source": [
        ""
      ],
      "execution_count": null,
      "outputs": []
    }
  ]
}