{"action":"created","issue":{"url":"https://api.github.com/repos/joowani/binarytree/issues/10","repository_url":"https://api.github.com/repos/joowani/binarytree","labels_url":"https://api.github.com/repos/joowani/binarytree/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/joowani/binarytree/issues/10/comments","events_url":"https://api.github.com/repos/joowani/binarytree/issues/10/events","html_url":"https://github.com/joowani/binarytree/pull/10","id":262162127,"number":10,"title":"Parent and Levels","user":{"login":"cshaley","id":6740446,"avatar_url":"https://avatars0.githubusercontent.com/u/6740446?v=4","gravatar_id":"","url":"https://api.github.com/users/cshaley","html_url":"https://github.com/cshaley","followers_url":"https://api.github.com/users/cshaley/followers","following_url":"https://api.github.com/users/cshaley/following{/other_user}","gists_url":"https://api.github.com/users/cshaley/gists{/gist_id}","starred_url":"https://api.github.com/users/cshaley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cshaley/subscriptions","organizations_url":"https://api.github.com/users/cshaley/orgs","repos_url":"https://api.github.com/users/cshaley/repos","events_url":"https://api.github.com/users/cshaley/events{/privacy}","received_events_url":"https://api.github.com/users/cshaley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-10-02T17:30:32Z","updated_at":"2017-10-02T21:33:44Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/joowani/binarytree/pulls/10","html_url":"https://github.com/joowani/binarytree/pull/10","diff_url":"https://github.com/joowani/binarytree/pull/10.diff","patch_url":"https://github.com/joowani/binarytree/pull/10.patch"},"body":"Added parent attribute functionality for nodes.  Each node has a parent attribute, which is automatically set when defining a node using e.g. `myNode.left = Node(6)`.  Parent definition was also added to other functions in order to incorporate it more broadly.  \r\n\r\nAdded some basic tree level functionality.  e.g. `myNode.level()` returns distance from the root node.  So for the root node, `level()` returns 0.  `bt.get_levels(t)` returns a dictionary of form `{0:\r\n [rootnode], 1: [1st level nodes]}`.  \r\n\r\nA couple of other small functions are included as well.\r\nSample functionality:\r\n\r\nIn:\r\n```\r\nt = convert(list(range(10)))\r\nbt.show_ids(t)\r\n```\r\nOut:\r\n```\r\n        ____0__    \r\n       /       \\   \r\n    __1__       2  \r\n   /     \\     / \\ \r\n  3       4   5   6\r\n / \\     /         \r\n7   8   9          \r\n```\r\n                   \r\nIn:\r\n```\r\nt.right.right.right = Node(11)\r\nbt.show_ids(t)\r\n```\r\nOut:\r\n```\r\n        ____0__       \r\n       /       \\      \r\n    __1__       2     \r\n   /     \\     / \\    \r\n  3       4   5   6   \r\n / \\     /         \\  \r\n7   8   9           10\r\n```                \r\nIn :\r\n```\r\nt.right.right.right.parent\r\n```\r\nOut:\r\n```\r\nNode(6)\r\n```\r\nIn :\r\n```\r\nprint(t.parent)\r\n```\r\nOut:\r\n```\r\nNone\r\n```\r\nIn:\r\n```\r\nt.is_root()\r\n```\r\nOut:\r\n```\r\nTrue\r\n```\r\nIn:\r\n```\r\nt.is_leaf()\r\n```\r\nOut:\r\n```\r\nFalse\r\n```\r\nIn:\r\n```\r\nt.right.right.level()\r\n```\r\nOut:\r\n```\r\n2\r\n```\r\nIn:\r\n```\r\nbt.get_levels(t, show_values=True, show_nulls=True)\r\n```\r\nOut:\r\n```\r\n{0: [0], 1: [1, 2], 2: [3, 4, 5, 6], 3: [7, 8, 9, None, None, None, None, 11]}\r\n```\r\nIn:\r\n```\r\nbt.get_levels(t, show_values=True)\r\n```\r\nOut:\r\n```\r\n{0: [0], 1: [1, 2], 2: [3, 4, 5, 6], 3: [7, 8, 9, 11]}\r\n```\r\nIn:\r\n```\r\nbt.get_level(t,2)\r\n```\r\nOut:\r\n```\r\n[Node(3), Node(4), Node(5), Node(6)]\r\n```\r\n\r\nCovers the first three bullets of issue #9 "},"comment":{"url":"https://api.github.com/repos/joowani/binarytree/issues/comments/333671863","html_url":"https://github.com/joowani/binarytree/pull/10#issuecomment-333671863","issue_url":"https://api.github.com/repos/joowani/binarytree/issues/10","id":333671863,"user":{"login":"coveralls","id":2354108,"avatar_url":"https://avatars1.githubusercontent.com/u/2354108?v=4","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2017-10-02T21:33:44Z","updated_at":"2017-10-02T21:33:44Z","author_association":"NONE","body":"\n[![Coverage Status](https://coveralls.io/builds/13534469/badge)](https://coveralls.io/builds/13534469)\n\nCoverage remained the same at 100.0% when pulling **76607fca2c20e3a4e339fea6005eb7719177ce4d on cshaley:master** into **32bf26a1e49616fd6180aee8097d3eb24d1ddfce on joowani:master**.\n"}}
{"actor":{"display_login":"coveralls"}}