{
"cells": [
{
"cell_type": "markdown",
"id": "c4fbb6e9",
"metadata": {},
"source": [
"# Static Rotational Graph (SRG) kernel "
]
},
{
"cell_type": "markdown",
"id": "14177922",
"metadata": {},
"source": [
"The SRG kernel is designed to provide an extensible tiling, where neighbour/adjacency relations are generated during construction, rendering a subsequent computation of cell neighbours obsolete"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "62946486",
"metadata": {
"pycharm": {
"is_executing": true
}
},
"outputs": [],
"source": [
"from hypertiling import HyperbolicTiling\n",
"from hypertiling.graphics.plot import plot_tiling\n",
"import matplotlib.pyplot as plt\n",
"import hypertiling.graphics.svg as svg"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "33b9af66",
"metadata": {
"scrolled": false
},
"outputs": [],
"source": [
"p, q, n = 3, 7, 2\n",
"T = HyperbolicTiling(p, q, n, kernel=\"SRG\", center=\"vertex\")\n",
"T.add_layer()"
]
},
{
"cell_type": "markdown",
"id": "13884058",
"metadata": {},
"source": [
"Access neighbours"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "f41a42d2",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[0, 2, 3, 4, 5, 6, 11, 12, 13, 14, 15, 16, 17, 18, 19]\n",
"[0, 38, 6, 8, 7, 10, 11, 39, 40, 41, 42, 43, 44, 45, 46]\n"
]
}
],
"source": [
"print(T.get_nbrs(1))\n",
"print(T.get_nbrs(9))"
]
},
{
"cell_type": "markdown",
"id": "e94f6996",
"metadata": {},
"source": [
"New layers can be added anytime"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "a3da9781",
"metadata": {},
"outputs": [],
"source": [
"T.add_layer()"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "2b0d11ac",
"metadata": {},
"outputs": [
{
"data": {
"image/svg+xml": [
""
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"tiling_colors = [1.0]\n",
"tiling_svg = svg.make_svg(T, unitcircle=True, cmap=\"YlOrBr\")\n",
"svg.draw_svg(tiling_svg)\n",
"svg.write_svg(\"dummy.svg\", tiling_svg)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5d99afcc",
"metadata": {},
"outputs": [],
"source": [
"plot_tiling(T, dpi=220)\n",
"for i in range(len(T)):\n",
" z = T.get_center(i)\n",
" l = T.get_layer(i)\n",
" t = plt.text(z.real, z.imag, \"\", fontsize=15-4*l, ha=\"center\", va=\"center\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "76b49349",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.9.1"
}
},
"nbformat": 4,
"nbformat_minor": 5
}