{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "autoscroll": false,
    "ein.tags": "worksheet-0",
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "\n",
    "import paths\n",
    "\n",
    "from ged.GED import ged\n",
    "from utils.graphfiles import loadDataset\n",
    "from ged.costfunctions import RiesenCostFunction, BasicCostFunction\n",
    "from ged.bipartiteGED import computeBipartiteCostMatrix, getOptimalMapping"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "autoscroll": false,
    "ein.tags": "worksheet-0",
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD8CAYAAACMwORRAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xt8VNW99/HPL9BIohKpwOOFq6dclALaBqqvB60Va+Um\nhVgOnKKlx8oxIE89CtUAcrdQudTKJYrnqUFqq9ZE4FQQL209lIImKAWBogHtIcIxqcV4ISCXdf7Y\nEwzJJDNJZrJndr7v1ysvM3uv2fPbzuTLmrX3Xtucc4iISLCk+F2AiIjEnsJdRCSAFO4iIgGkcBcR\nCSCFu4hIACncRUQCSOEuIhJACncRkQBSuIuIBFBLv164bdu2rkuXLn69vIhIUtq2bdvfnXPtIrXz\nLdy7dOlCUVGRXy8vIpKUzOxv0bTTsIyISAAp3EVEAkjhLiISQAp3EZEAUriLiASQwl1EJIAU7iIi\nAaRwFxEJIN8uYhI5Q2kp5OXBjh1QXg4ZGdCnD/zwh9Au4sV4IlKNwl38VVgI8+fDhg3e46NHv1hX\nUAAzZ8KgQZCTA/36+VOjSBLSsIz4JzcXrr0W1qzxQr1qsANUVHjL1qzx2uXm+lGlSFJSz138kZsL\nkyfDkSOR2zrntZs82XucnR3f2kQCQD13aXqFhTWCfRmQCZwFjKvteZUBrwnnRCJSuEvTm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XAXOBB4GhTFhdD0ezn7cBy59xhAOdcaRPXGAvR7KcD\nWod+zwAONmF9MeGc+y/gH3U0GQ484TxbgfPM7MJY1xHEcL8YOFDlcUloWdg2zrkTQDlwfpNUFzvR\n7GdVt+H1FpJJxH00syuAjs653zVlYTEWzXvZHehuZpvNbKuZ3dhk1cVONPs5CxhrZiXAemBS05TW\npOr7t9sgQbyHargeePVTgqJpk+ii3gczGwtkAt+Ma0WxV+c+mlkK8HNgXFMVFCfRvJct8YZmrsX7\nBrbJzL7qnPsozrXFUjT7OQbIc84tNrOrgNWh/TwV//KaTJPkTxB77iVAxyqPO1Dzq93pNmbWEu/r\nX11foxJRNPuJmV0PTANucs4da6LaYiXSPp4LfBX4o5m9hzd+uS4JD6pG+5ld65w77px7F9iLF/bJ\nJJr9vA14BsA5twVohTcfS5BE9bfbWEEM90Kgm5l1NbNUvAOm66q1WQf8IPT7zcDvXehIRxKJuJ+h\nIYtH8YI9Gcdo69xH51y5c66tc66Lc64L3nGFm5xzRf6U22DRfGbX4B0gx8za4g3T7G/SKhsvmv38\nb2AggJldihfuZU1aZfytA24NnTVzJVDunDsU81fx+8hynI5WDwbexjsyPy20bA7eHz54H5jfAsXA\n68Alftccp/18GfgA2B76Wed3zbHex2pt/0gSni0T5XtpwBJgN7ATGO13zXHaz8uAzXhn0mwHbvC7\n5gbs42+AQ8BxvF76bcAdwB1V3svlof8HO+P1mdUVqiIiARTEYRkRkWZP4S4iEkAKdxGRAFK4i4gE\nkMJdRCSAFO4iIgGkcBcRCSCFu4hIAP0v8ncXPBCruC4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x7f61fed58cc0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[0, 1, 4]\n"
     ]
    }
   ],
   "source": [
    "import networkx as nx\n",
    "import numpy as np\n",
    "import matplotlib.pyplot  as plt\n",
    "dataset, y = loadDataset(\"/home/bgauzere/work/Datasets/Acyclic/dataset_bps.ds\")\n",
    "nx.draw_networkx(dataset[12])\n",
    "plt.show()\n",
    "print(list(dataset[12][3]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "autoscroll": false,
    "ein.tags": "worksheet-0",
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [],
   "source": [
    "cf = BasicCostFunction(1,3,1,3)\n",
    "N=len(dataset)\n",
    "N=10\n",
    "ged_distances = np.zeros((N,N))\n",
    "for i in range(0,N):\n",
    "    for j in range(i,N):\n",
    "          ged_distances[j,i] = ged_distances[i,j] = ged(dataset[i],dataset[j],cf=cf, method='Riesen')[0]\n",
    "        \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "autoscroll": false,
    "ein.tags": "worksheet-0",
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(0, array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]), array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]))\n",
      "(0, array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]), array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]))\n",
      "(0, array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]), array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]))\n"
     ]
    }
   ],
   "source": [
    "G1=dataset[12]\n",
    "G2=dataset[12]\n",
    "\n",
    "print(ged(G1,G2))\n",
    "print(ged(G1,G2,method='Basic'))\n",
    "print(ged(G1,G2,method='Riesen'))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "autoscroll": false,
    "ein.tags": "worksheet-0",
    "slideshow": {
     "slide_type": "-"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{0: {0: [0], 3: [0, 3], 1: [0, 3, 1], 4: [0, 3, 4], 2: [0, 3, 4, 2]}, 1: {1: [1], 3: [1, 3], 0: [1, 3, 0], 4: [1, 3, 4], 2: [1, 3, 4, 2]}, 2: {2: [2], 4: [2, 4], 3: [2, 4, 3], 0: [2, 4, 3, 0], 1: [2, 4, 3, 1]}, 3: {3: [3], 0: [3, 0], 1: [3, 1], 4: [3, 4], 2: [3, 4, 2]}, 4: {4: [4], 2: [4, 2], 3: [4, 3], 0: [4, 3, 0], 1: [4, 3, 1]}}\n",
      "[[ 0.  2.  3.  1.  2.]\n",
      " [ 2.  0.  3.  1.  2.]\n",
      " [ 3.  3.  0.  2.  1.]\n",
      " [ 1.  1.  2.  0.  1.]\n",
      " [ 2.  2.  1.  1.  0.]]\n"
     ]
    }
   ],
   "source": [
    "l = nx.shortest_path(G1)\n",
    "print(l)\n",
    "\n",
    "distances = np.zeros((G1.number_of_nodes(),G1.number_of_nodes()))\n",
    "for i in l.keys():\n",
    "    for j in l[i].keys():\n",
    "        distances[i,j] = len(l[i][j])-1\n",
    "\n",
    "print(distances)\n"
   ]
  }
 ],
 "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.5.2"
  },
  "name": "test_lib.ipynb"
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
