nlp-lab/Jonas_Solutions/Untitled.ipynb

86 lines
22 KiB
Plaintext
Raw Normal View History

2018-05-09 16:50:59 +02:00
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Sandbox"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## How to plot a directed Graph:\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYYAAAD8CAYAAABzTgP2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3XdYVGf2B/DvKCBNEBgQrChKjAUxgCAaFRt2BTVRsRAFSyzRiC1xFdSIYk80RMGYtUSNNdGfXbCiFEsUu7GhUbEQFASEmfP7YxbiqMDMMMOdcj7Pw+M6c+97z7i7c3jbeUVERGCMMcb+p4LQATDGGNMunBgYY4zJ4cTAGGNMDicGxhhjcjgxMMYYk8OJgTHGmBxODIwxxuRwYmCMMSaHEwNjjDE5nBgYY4zJ4cTAGGNMDicGxhhjcjgxMMYYk8OJgTHGmBxODIwxxuRwYmCMMSaHEwNjjDE5nBgYY4zJ4cTAGGNMjpHQATADk54O/PILcPEikJkJWFsDbm7AF18A9vZCR8cYAyAiIhI6CGYAkpOByEhg3z7Z33Nz/33PzAwgArp0AaZPB7y8hImRMQaAEwMrD9HRQFgYkJMjSwDFEYlkSWLRImD06PKLjzEmh4eSmGYVJoXXr0u/lkh2XViY7O+cHBgTBPcYmOYkJwNt2yqWFN5lbg4cOwZ4eqo9LMZYyXhVEtOcyEjZ8JEqcnJk9zPGyh33GJhmpKcDtWvLTzIry9QUuH+fVysxVs64x8A045dfyt6GSKSedhhjSuHEwDTj4sWy9RYA2XDSpUvqiYcxpjBODEwzMjPV005GRtF/zM/Px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30Ew0ZMoTq1atH1tbW5O/vTxEREXT48GF6+fKl0GEyA8KJgaksPz+f/Pz8aPr06SVeN3v2bAoLCyvxmqCgIFq9enXR33fs2EHNmjWjf/75h2rWrElxcXGlxrNt2zYSi8UUExNT7DVSqZS2bt1Krq6u5OfnR4mJiaW2K4QnT57Qrl27aMqUKdSqVSuysLAgd3d3+vLLL2nDhg10+/ZtrUlsTP9wYmAqCwsLo44dO1JBQUGJ17Vp04b27t1b4jWxsbE0cODAor9LpVJyd3ennTt30u7du8nFxYWys7NLjenq1avUoEEDCgkJoZycnGKvy8/Pp9WrV1P16tWpT58+xQ6DaYvc3Fw6ffo0LV68mPr06UOOjo7k6OhIgYGBtHjxYjp9+jTl5uYKHSbTE5wYmEq2bNlCzs7OpS4Jzc7OJgsLC3r16lWJ1926dYucnJzkfgv+/fffqWnTpiSRSKh///40efJkhWJ7+fIl9e3blzw9PenevXulxjd//nwSi8UUEhJCaWlpCj1DaFKplO7cuUMbN26kMWPGkLu7O5mbm1PLli1p8uTJtHPnTnr8+LHQYTIdxYmBKe3SpUskFovp3LlzpV578OBBatmyZanXSaVSqlmzJl2/fl3uNQ8PD9q+fTs9efKEHBwcKCUlRaEYpVIpLVy4kKpWrUqHDh0q9foXL17Q1KlTydbWliZPnkzPnz9X6Dna5OXLl3T48GGaPXs2de7cmaytrcnFxYWGDBlCP/30E128eLHU3h1jRJwYmJIyMjKofv36tG7dOoWunzZtGs2cOVOhawcPHkw//fST3Gu7d++mxo0bk0QioXXr1lHTpk3pzZs3CscbFxdHjo6OFBkZqdCY/IMHD2jEiBEkFotp3rx5Cg1faSuJREKpqam0atUqGjp0KNWvX5+sra2pU6dOFB4eTgcPHqTMzEyhw2RaiBMDU5hEIqEePXrQ2LFjFb7Hy8uLjh07ptC1P//8M/Xv31/uNalUSl5eXvTbb7+RVColf39/mjdvnlJxp6W
"text/plain": [
"<matplotlib.figure.Figure at 0x7f449722f630>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import networkx as nx\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"\n",
"fig_1, ax_1 = plt.subplots()\n",
"\n",
"G = nx.DiGraph()\n",
"G.add_nodes_from(range(1,10))\n",
"G.add_edges_from([(i,1) for i in range(2,10)])\n",
"\n",
"nx.draw(G)\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}