Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement set operations for NodeView and EdgeView #208

Merged
merged 3 commits into from
Nov 2, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
roll back an f-string feature that is not available in py3.7
  • Loading branch information
leotrs committed Nov 1, 2022
commit 07d3dd5d28bf735e1cf4ffaea67daa53ab53481a
28 changes: 18 additions & 10 deletions tutorials/Tutorial 6 - Statistics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,14 @@
"H.nodes.filterby(\"degree\", H.nodes.degree.max())"
]
},
{
"cell_type": "markdown",
"id": "cc5df033",
"metadata": {},
"source": [
"## Set operations"
]
},
{
"cell_type": "markdown",
"id": "11548f49",
Expand Down Expand Up @@ -788,22 +796,22 @@
"name": "stdout",
"output_type": "stream",
"text": [
"nodes1 - nodes2 = NodeView((4,))\n",
"nodes2 - nodes1 = NodeView(())\n",
"nodes1 & nodes2 = NodeView((2, 5))\n",
"nodes1 | nodes2 = NodeView((2, 4, 5))\n",
"nodes1 ^ nodes2 = NodeView((4,))\n"
"nodes1 - nodes2 = [4]\n",
"nodes2 - nodes1 = []\n",
"nodes1 & nodes2 = [2, 5]\n",
"nodes1 | nodes2 = [2, 4, 5]\n",
"nodes1 ^ nodes2 = [4]\n"
]
}
],
"source": [
"nodes1 = H.nodes.filterby(\"degree\", 2)\n",
"nodes2 = H.nodes.filterby_attr(\"color\", \"blue\")\n",
"print(f\"{nodes1 - nodes2 = }\")\n",
"print(f\"{nodes2 - nodes1 = }\")\n",
"print(f\"{nodes1 & nodes2 = }\")\n",
"print(f\"{nodes1 | nodes2 = }\")\n",
"print(f\"{nodes1 ^ nodes2 = }\")"
"print(f\"nodes1 - nodes2 = {nodes1 - nodes2}\")\n",
"print(f\"nodes2 - nodes1 = {nodes2 - nodes1}\")\n",
"print(f\"nodes1 & nodes2 = {nodes1 & nodes2}\")\n",
"print(f\"nodes1 | nodes2 = {nodes1 | nodes2}\")\n",
"print(f\"nodes1 ^ nodes2 = {nodes1 ^ nodes2}\")"
]
},
{
Expand Down