{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "%matplotlib inline"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n# Dot and radial node layouts\n\nPlot a tree or other directed, acyclic graph with the :code:`'dot'` or :code:`'radial'` node layout.\nNetgraph uses an implementation of the Sugiyama algorithm provided by the grandalf_ library\n(and thus does not require Graphviz to be installed).\n\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "import matplotlib.pyplot as plt\nimport networkx as nx\n\nfrom netgraph import Graph\n\nunbalanced_tree = [\n    (0, 1),\n    (0, 2),\n    (0, 3),\n    (0, 4),\n    (0, 5),\n    (2, 6),\n    (3, 7),\n    (3, 8),\n    (4, 9),\n    (4, 10),\n    (4, 11),\n    (5, 12),\n    (5, 13),\n    (5, 14),\n    (5, 15)\n]\n\nbalanced_tree = nx.balanced_tree(3, 3)\n\nfig, (ax1, ax2) = plt.subplots(1, 2)\nGraph(unbalanced_tree, node_layout='dot', ax=ax1)\nGraph(balanced_tree, node_layout='radial', ax=ax2)\nplt.show()"
      ]
    }
  ],
  "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.8"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}