Skip to content

Commit 2694746

Browse files
committed
Merge feature_example.ipynb
1 parent d39cc4e commit 2694746

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

examples/feature_example.ipynb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,40 @@
183183
"\n",
184184
"g.show_cypher(\"MATCH (s)-[r]->(t) RETURN s,r,t LIMIT 25\")"
185185
]
186+
},
187+
{
188+
"cell_type": "markdown",
189+
"id": "58927c27-4a76-4835-bd6e-f0dd0f2fce04",
190+
"metadata": {},
191+
"source": [
192+
"## Configure node-to-cell mapping\n",
193+
"\n",
194+
"The node-to-cell mapping allows to fine-tune layout results by assigning preferred cell constraints for specific nodes.\n",
195+
"\n",
196+
"This is particularly useful to highlight specific items structurally aside from visual features like color or size."
197+
]
198+
},
199+
{
200+
"cell_type": "code",
201+
"execution_count": null,
202+
"id": "77d47bf2-5f34-4034-ad40-cb0c32a63fee",
203+
"metadata": {},
204+
"outputs": [],
205+
"source": [
206+
"g.del_parent_relationship_configuration(\"COUNTRY\")\n",
207+
"\n",
208+
"# highlight Bank of New York and China Construction Bank\n",
209+
"def get_cell_mapping(node):\n",
210+
" name = node[\"properties\"].get(\"name\")\n",
211+
" if name == \"The Bank of New York Mellon Corp.\" or name == \"China Construction Bank Corporation\":\n",
212+
" return (0,0)\n",
213+
" return (1,0)\n",
214+
"\n",
215+
"g.node_cell_mapping = get_cell_mapping\n",
216+
"\n",
217+
"# layouts interpret node-to-cell mapping differently\n",
218+
"g.show_cypher(\"MATCH (s)-[r]->(t) RETURN s,r,t LIMIT 25\", layout='hierarchic')"
219+
]
186220
}
187221
],
188222
"metadata": {

0 commit comments

Comments
 (0)