Skip to content
Snippets Groups Projects
test_init_graphs.ipynb 3.95 KiB
Newer Older
Felix's avatar
Felix committed
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import networkx as nx\n",
    "import numpy as np\n",
    "import sys\n",
    "sys.path.insert(0,'../kirchhoff')\n",
    "\n",
    "import kirchhoff_init as ki\n",
    "import kirchhoff_flow as kiw\n",
    "import kirchhoff_flux as kix\n",
    "import kirchhoff_dual as kid\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "circuit(): initialized and ready for (some) action :)\n"
     ]
    }
   ],
   "source": [
    "n=3\n",
    "G=nx.grid_graph(( n,n,1))\n",
    "K = ki.initialize_circuit_from_networkx(G)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "circuit(): initialized and ready for (some) action :)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<kirchhoff_init.circuit at 0x16367462c48>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kiw.initialize_circuit_from_networkx(G)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "circuit(): initialized and ready for (some) action :)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<kirchhoff_init.circuit at 0x1636747bd48>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kix.initialize_circuit_from_networkx(G)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "circuit(): initialized and ready for (some) action :)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<kirchhoff_flow.flow_circuit at 0x1636748c088>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kiw.initialize_flow_circuit_from_crystal('chain',3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "circuit(): initialized and ready for (some) action :)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<kirchhoff_flow.flow_circuit at 0x16367467288>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kiw.initialize_flow_circuit_from_random(random_type='voronoi_volume')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "circuit(): initialized and ready for (some) action :)\n",
      "circuit(): initialized and ready for (some) action :)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<kirchhoff_dual.dual_circuit at 0x163674ffd48>"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "kid.initialize_dual_flux_circuit_from_minsurf('laves',3)"
   ]
  },
  {
   "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.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}