neo4j-viz 0.2.6__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/PKG-INFO +13 -10
  2. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/README.md +4 -2
  3. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/pyproject.toml +15 -9
  4. neo4j_viz-0.3.0/src/neo4j_viz/colors.py +303 -0
  5. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/src/neo4j_viz/gds.py +11 -2
  6. neo4j_viz-0.3.0/src/neo4j_viz/gql_create.py +356 -0
  7. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/src/neo4j_viz/neo4j.py +44 -49
  8. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/src/neo4j_viz/node.py +7 -1
  9. neo4j_viz-0.3.0/src/neo4j_viz/nvl.py +125 -0
  10. neo4j_viz-0.3.0/src/neo4j_viz/pandas.py +94 -0
  11. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/src/neo4j_viz/relationship.py +7 -1
  12. neo4j_viz-0.3.0/src/neo4j_viz/resources/icons/screenshot.svg +3 -0
  13. neo4j_viz-0.3.0/src/neo4j_viz/resources/icons/zoom-in.svg +3 -0
  14. neo4j_viz-0.3.0/src/neo4j_viz/resources/icons/zoom-out.svg +3 -0
  15. neo4j_viz-0.3.0/src/neo4j_viz/resources/nvl_entrypoint/base.js +2 -0
  16. neo4j_viz-0.3.0/src/neo4j_viz/resources/nvl_entrypoint/styles.css +53 -0
  17. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/src/neo4j_viz/visualization_graph.py +105 -33
  18. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/src/neo4j_viz.egg-info/PKG-INFO +13 -10
  19. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/src/neo4j_viz.egg-info/SOURCES.txt +6 -0
  20. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/src/neo4j_viz.egg-info/requires.txt +8 -7
  21. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/tests/test_colors.py +102 -34
  22. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/tests/test_gds.py +18 -9
  23. neo4j_viz-0.3.0/tests/test_gql_create.py +219 -0
  24. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/tests/test_neo4j.py +52 -40
  25. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/tests/test_node.py +5 -0
  26. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/tests/test_pandas.py +7 -7
  27. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/tests/test_relationship.py +6 -5
  28. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/tests/test_render.py +4 -2
  29. neo4j_viz-0.2.6/src/neo4j_viz/colors.py +0 -22
  30. neo4j_viz-0.2.6/src/neo4j_viz/nvl.py +0 -66
  31. neo4j_viz-0.2.6/src/neo4j_viz/pandas.py +0 -60
  32. neo4j_viz-0.2.6/src/neo4j_viz/resources/nvl_entrypoint/base.js +0 -2
  33. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/setup.cfg +0 -0
  34. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/src/neo4j_viz/__init__.py +0 -0
  35. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/src/neo4j_viz/node_size.py +0 -0
  36. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/src/neo4j_viz/options.py +0 -0
  37. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/src/neo4j_viz/py.typed +0 -0
  38. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/src/neo4j_viz.egg-info/dependency_links.txt +0 -0
  39. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/src/neo4j_viz.egg-info/top_level.txt +0 -0
  40. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/tests/test_notebooks.py +0 -0
  41. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/tests/test_options.py +0 -0
  42. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/tests/test_pinned.py +0 -0
  43. {neo4j_viz-0.2.6 → neo4j_viz-0.3.0}/tests/test_sizes.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: neo4j-viz
3
- Version: 0.2.6
3
+ Version: 0.3.0
4
4
  Summary: A simple graph visualization tool
5
5
  Author-email: Neo4j <team-gds@neo4j.org>
6
6
  Project-URL: Homepage, https://neo4j.com/
@@ -33,15 +33,16 @@ Requires-Dist: pydantic<3,>=2
33
33
  Requires-Dist: pydantic-extra-types<3,>=2
34
34
  Requires-Dist: enum-tools==0.12.0
35
35
  Provides-Extra: dev
36
- Requires-Dist: ruff==0.9.7; extra == "dev"
36
+ Requires-Dist: ruff==0.11.8; extra == "dev"
37
37
  Requires-Dist: mypy==1.15.0; extra == "dev"
38
38
  Requires-Dist: pytest==8.3.4; extra == "dev"
39
- Requires-Dist: selenium==4.28.1; extra == "dev"
39
+ Requires-Dist: selenium==4.32.0; extra == "dev"
40
40
  Requires-Dist: ipykernel==6.29.5; extra == "dev"
41
41
  Requires-Dist: palettable==3.3.3; extra == "dev"
42
42
  Requires-Dist: pytest-mock==3.14.0; extra == "dev"
43
43
  Requires-Dist: nbconvert==7.16.6; extra == "dev"
44
- Requires-Dist: streamlit==1.42.0; extra == "dev"
44
+ Requires-Dist: streamlit==1.45.0; extra == "dev"
45
+ Requires-Dist: matplotlib>=3.9.4; extra == "dev"
45
46
  Provides-Extra: docs
46
47
  Requires-Dist: sphinx==8.1.3; extra == "docs"
47
48
  Requires-Dist: enum-tools[sphinx]; extra == "docs"
@@ -55,12 +56,12 @@ Requires-Dist: graphdatascience<2,>=1; extra == "gds"
55
56
  Provides-Extra: neo4j
56
57
  Requires-Dist: neo4j; extra == "neo4j"
57
58
  Provides-Extra: notebook
58
- Requires-Dist: ipykernel==6.29.5; extra == "notebook"
59
- Requires-Dist: pykernel==0.1.6; extra == "notebook"
59
+ Requires-Dist: ipykernel>=6.29.5; extra == "notebook"
60
+ Requires-Dist: pykernel>=0.1.6; extra == "notebook"
60
61
  Requires-Dist: neo4j>=5.26.0; extra == "notebook"
61
62
  Requires-Dist: ipywidgets>=8.0.0; extra == "notebook"
62
- Requires-Dist: palettable==3.3.3; extra == "notebook"
63
- Requires-Dist: matplotlib==3.10.0; extra == "notebook"
63
+ Requires-Dist: palettable>=3.3.3; extra == "notebook"
64
+ Requires-Dist: matplotlib>=3.9.4; extra == "notebook"
64
65
  Requires-Dist: snowflake-snowpark-python==1.26.0; extra == "notebook"
65
66
 
66
67
  # Graph Visualization for Python by Neo4j
@@ -73,9 +74,9 @@ Requires-Dist: snowflake-snowpark-python==1.26.0; extra == "notebook"
73
74
  [![Community forum](https://img.shields.io/website?down_color=lightgrey&down_message=offline&label=Forums&logo=discourse&up_color=green&up_message=online&url=https%3A%2F%2Fcommunity.neo4j.com%2F)](https://community.neo4j.com)
74
75
  [![License](https://img.shields.io/pypi/l/neo4j-viz)](https://pypi.org/project/neo4j-viz/)
75
76
 
76
- `neo4j-viz` is a Python package for creating interactive graph visualizations based on data from Neo4j products.
77
+ `neo4j-viz` is a Python package for creating interactive graph visualizations.
77
78
 
78
- The output is of type `IPython.display.HTML` and can be viewed directly in a Jupyter Notebook, Streamlit.
79
+ The output is of type `IPython.display.HTML` and can be viewed directly in a Jupyter Notebook or Streamlit application.
79
80
  Alternatively, you can export the output to a file and view it in a web browser.
80
81
 
81
82
  The package wraps the [Neo4j Visualization JavaScript library (NVL)](https://neo4j.com/docs/nvl/current/).
@@ -98,9 +99,11 @@ The package wraps the [Neo4j Visualization JavaScript library (NVL)](https://neo
98
99
  * Colors
99
100
  * Captions
100
101
  * Pinning
102
+ * On hover tooltip
101
103
  * Relationship features:
102
104
  * Colors
103
105
  * Captions
106
+ * On hover tooltip
104
107
  * Graph features:
105
108
  * Zooming
106
109
  * Panning
@@ -8,9 +8,9 @@
8
8
  [![Community forum](https://img.shields.io/website?down_color=lightgrey&down_message=offline&label=Forums&logo=discourse&up_color=green&up_message=online&url=https%3A%2F%2Fcommunity.neo4j.com%2F)](https://community.neo4j.com)
9
9
  [![License](https://img.shields.io/pypi/l/neo4j-viz)](https://pypi.org/project/neo4j-viz/)
10
10
 
11
- `neo4j-viz` is a Python package for creating interactive graph visualizations based on data from Neo4j products.
11
+ `neo4j-viz` is a Python package for creating interactive graph visualizations.
12
12
 
13
- The output is of type `IPython.display.HTML` and can be viewed directly in a Jupyter Notebook, Streamlit.
13
+ The output is of type `IPython.display.HTML` and can be viewed directly in a Jupyter Notebook or Streamlit application.
14
14
  Alternatively, you can export the output to a file and view it in a web browser.
15
15
 
16
16
  The package wraps the [Neo4j Visualization JavaScript library (NVL)](https://neo4j.com/docs/nvl/current/).
@@ -33,9 +33,11 @@ The package wraps the [Neo4j Visualization JavaScript library (NVL)](https://neo
33
33
  * Colors
34
34
  * Captions
35
35
  * Pinning
36
+ * On hover tooltip
36
37
  * Relationship features:
37
38
  * Colors
38
39
  * Captions
40
+ * On hover tooltip
39
41
  * Graph features:
40
42
  * Zooming
41
43
  * Panning
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "neo4j-viz"
7
- version = "0.2.6"
7
+ version = "0.3.0"
8
8
  description = "A simple graph visualization tool"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Neo4j", email = "team-gds@neo4j.org" }]
@@ -41,15 +41,16 @@ requires-python = ">=3.9"
41
41
 
42
42
  [project.optional-dependencies]
43
43
  dev = [
44
- "ruff==0.9.7",
44
+ "ruff==0.11.8",
45
45
  "mypy==1.15.0",
46
46
  "pytest==8.3.4",
47
- "selenium==4.28.1",
47
+ "selenium==4.32.0",
48
48
  "ipykernel==6.29.5",
49
49
  "palettable==3.3.3",
50
50
  "pytest-mock==3.14.0",
51
51
  "nbconvert==7.16.6",
52
- "streamlit==1.42.0",
52
+ "streamlit==1.45.0",
53
+ "matplotlib>=3.9.4",
53
54
  ]
54
55
  docs = [
55
56
  "sphinx==8.1.3",
@@ -61,12 +62,12 @@ pandas = ["pandas>=2, <3", "pandas-stubs>=2, <3"]
61
62
  gds = ["graphdatascience>=1, <2"]
62
63
  neo4j = ["neo4j"]
63
64
  notebook = [
64
- "ipykernel==6.29.5",
65
- "pykernel==0.1.6",
65
+ "ipykernel>=6.29.5",
66
+ "pykernel>=0.1.6",
66
67
  "neo4j>=5.26.0",
67
68
  "ipywidgets>=8.0.0",
68
- "palettable==3.3.3",
69
- "matplotlib==3.10.0",
69
+ "palettable>=3.3.3",
70
+ "matplotlib>=3.9.4",
70
71
  "snowflake-snowpark-python==1.26.0",
71
72
  ]
72
73
 
@@ -87,7 +88,12 @@ include = [
87
88
  namespaces = false # only scan directories with __init__.py files (true by default)
88
89
 
89
90
  [tool.setuptools.package-data]
90
- neo4j_viz = ["resources/nvl_entrypoint/base.js", "py.typed"]
91
+ neo4j_viz = [
92
+ "resources/nvl_entrypoint/base.js",
93
+ "resources/nvl_entrypoint/styles.css",
94
+ "resources/icons/*.svg",
95
+ "py.typed"
96
+ ]
91
97
 
92
98
  [tool.pytest.ini_options]
93
99
  addopts = ["--import-mode=importlib"]
@@ -0,0 +1,303 @@
1
+ from collections.abc import Iterable
2
+ from enum import Enum
3
+ from typing import Any, Union
4
+
5
+ import enum_tools
6
+ from pydantic_extra_types.color import ColorType
7
+
8
+ ColorsType = Union[dict[Any, ColorType], Iterable[ColorType]]
9
+
10
+
11
+ @enum_tools.documentation.document_enum
12
+ class ColorSpace(Enum):
13
+ """
14
+ Describes the type of color space used by a color palette.
15
+ """
16
+
17
+ DISCRETE = "discrete"
18
+ """
19
+ This category describes a color palette that is a collection of different colors that are not necessarily related to
20
+ each other. Discrete color spaces are suitable for categorical data, where each unique category is represented by a
21
+ different color.
22
+ """
23
+ CONTINUOUS = "continuous"
24
+ """
25
+ This category describes a color palette that is a range/gradient of colors between two or more colors. Continuous
26
+ color spaces are suitable for continuous data (typically floats), where values can change smoothly.
27
+ """
28
+
29
+
30
+ # Comes from https://neo4j.design/40a8cff71/p/5639c0-color/t/page-5639c0-79109681-33
31
+ NEO4J_COLORS_DISCRETE = [
32
+ "#FFDF81",
33
+ "#C990C0",
34
+ "#F79767",
35
+ "#56C7E4",
36
+ "#F16767",
37
+ "#D8C7AE",
38
+ "#8DCC93",
39
+ "#ECB4C9",
40
+ "#4D8DDA",
41
+ "#FFC354",
42
+ "#DA7294",
43
+ "#579380",
44
+ ]
45
+ _NEO4J_COLORS_CONTINUOUS_BASE = ["#FFDF81", "#C990C0"]
46
+ NEO4J_COLORS_CONTINUOUS = [
47
+ (255, 223, 129),
48
+ (255, 223, 129),
49
+ (255, 222, 129),
50
+ (254, 222, 130),
51
+ (254, 222, 130),
52
+ (254, 221, 130),
53
+ (254, 221, 130),
54
+ (254, 221, 131),
55
+ (253, 221, 131),
56
+ (253, 220, 131),
57
+ (253, 220, 131),
58
+ (253, 220, 132),
59
+ (252, 219, 132),
60
+ (252, 219, 132),
61
+ (252, 219, 132),
62
+ (252, 218, 133),
63
+ (252, 218, 133),
64
+ (251, 218, 133),
65
+ (251, 217, 133),
66
+ (251, 217, 134),
67
+ (251, 217, 134),
68
+ (251, 216, 134),
69
+ (250, 216, 134),
70
+ (250, 216, 135),
71
+ (250, 216, 135),
72
+ (250, 215, 135),
73
+ (249, 215, 135),
74
+ (249, 215, 136),
75
+ (249, 214, 136),
76
+ (249, 214, 136),
77
+ (249, 214, 136),
78
+ (248, 213, 137),
79
+ (248, 213, 137),
80
+ (248, 213, 137),
81
+ (248, 212, 137),
82
+ (248, 212, 138),
83
+ (247, 212, 138),
84
+ (247, 212, 138),
85
+ (247, 211, 138),
86
+ (247, 211, 139),
87
+ (247, 211, 139),
88
+ (246, 210, 139),
89
+ (246, 210, 139),
90
+ (246, 210, 140),
91
+ (246, 209, 140),
92
+ (245, 209, 140),
93
+ (245, 209, 140),
94
+ (245, 208, 141),
95
+ (245, 208, 141),
96
+ (245, 208, 141),
97
+ (244, 208, 141),
98
+ (244, 207, 142),
99
+ (244, 207, 142),
100
+ (244, 207, 142),
101
+ (244, 206, 142),
102
+ (243, 206, 143),
103
+ (243, 206, 143),
104
+ (243, 205, 143),
105
+ (243, 205, 143),
106
+ (243, 205, 144),
107
+ (242, 204, 144),
108
+ (242, 204, 144),
109
+ (242, 204, 144),
110
+ (242, 203, 145),
111
+ (241, 203, 145),
112
+ (241, 203, 145),
113
+ (241, 203, 145),
114
+ (241, 202, 146),
115
+ (241, 202, 146),
116
+ (240, 202, 146),
117
+ (240, 201, 146),
118
+ (240, 201, 147),
119
+ (240, 201, 147),
120
+ (240, 200, 147),
121
+ (239, 200, 147),
122
+ (239, 200, 148),
123
+ (239, 199, 148),
124
+ (239, 199, 148),
125
+ (238, 199, 148),
126
+ (238, 199, 149),
127
+ (238, 198, 149),
128
+ (238, 198, 149),
129
+ (238, 198, 149),
130
+ (237, 197, 150),
131
+ (237, 197, 150),
132
+ (237, 197, 150),
133
+ (237, 196, 150),
134
+ (237, 196, 150),
135
+ (236, 196, 151),
136
+ (236, 195, 151),
137
+ (236, 195, 151),
138
+ (236, 195, 151),
139
+ (236, 194, 152),
140
+ (235, 194, 152),
141
+ (235, 194, 152),
142
+ (235, 194, 152),
143
+ (235, 193, 153),
144
+ (234, 193, 153),
145
+ (234, 193, 153),
146
+ (234, 192, 153),
147
+ (234, 192, 154),
148
+ (234, 192, 154),
149
+ (233, 191, 154),
150
+ (233, 191, 154),
151
+ (233, 191, 155),
152
+ (233, 190, 155),
153
+ (233, 190, 155),
154
+ (232, 190, 155),
155
+ (232, 190, 156),
156
+ (232, 189, 156),
157
+ (232, 189, 156),
158
+ (231, 189, 156),
159
+ (231, 188, 157),
160
+ (231, 188, 157),
161
+ (231, 188, 157),
162
+ (231, 187, 157),
163
+ (230, 187, 158),
164
+ (230, 187, 158),
165
+ (230, 186, 158),
166
+ (230, 186, 158),
167
+ (230, 186, 159),
168
+ (229, 186, 159),
169
+ (229, 185, 159),
170
+ (229, 185, 159),
171
+ (229, 185, 160),
172
+ (229, 184, 160),
173
+ (228, 184, 160),
174
+ (228, 184, 160),
175
+ (228, 183, 161),
176
+ (228, 183, 161),
177
+ (227, 183, 161),
178
+ (227, 182, 161),
179
+ (227, 182, 162),
180
+ (227, 182, 162),
181
+ (227, 181, 162),
182
+ (226, 181, 162),
183
+ (226, 181, 163),
184
+ (226, 181, 163),
185
+ (226, 180, 163),
186
+ (226, 180, 163),
187
+ (225, 180, 164),
188
+ (225, 179, 164),
189
+ (225, 179, 164),
190
+ (225, 179, 164),
191
+ (225, 178, 165),
192
+ (224, 178, 165),
193
+ (224, 178, 165),
194
+ (224, 177, 165),
195
+ (224, 177, 166),
196
+ (223, 177, 166),
197
+ (223, 177, 166),
198
+ (223, 176, 166),
199
+ (223, 176, 167),
200
+ (223, 176, 167),
201
+ (222, 175, 167),
202
+ (222, 175, 167),
203
+ (222, 175, 168),
204
+ (222, 174, 168),
205
+ (222, 174, 168),
206
+ (221, 174, 168),
207
+ (221, 173, 169),
208
+ (221, 173, 169),
209
+ (221, 173, 169),
210
+ (220, 173, 169),
211
+ (220, 172, 170),
212
+ (220, 172, 170),
213
+ (220, 172, 170),
214
+ (220, 171, 170),
215
+ (219, 171, 171),
216
+ (219, 171, 171),
217
+ (219, 170, 171),
218
+ (219, 170, 171),
219
+ (219, 170, 171),
220
+ (218, 169, 172),
221
+ (218, 169, 172),
222
+ (218, 169, 172),
223
+ (218, 168, 172),
224
+ (218, 168, 173),
225
+ (217, 168, 173),
226
+ (217, 168, 173),
227
+ (217, 167, 173),
228
+ (217, 167, 174),
229
+ (216, 167, 174),
230
+ (216, 166, 174),
231
+ (216, 166, 174),
232
+ (216, 166, 175),
233
+ (216, 165, 175),
234
+ (215, 165, 175),
235
+ (215, 165, 175),
236
+ (215, 164, 176),
237
+ (215, 164, 176),
238
+ (215, 164, 176),
239
+ (214, 164, 176),
240
+ (214, 163, 177),
241
+ (214, 163, 177),
242
+ (214, 163, 177),
243
+ (213, 162, 177),
244
+ (213, 162, 178),
245
+ (213, 162, 178),
246
+ (213, 161, 178),
247
+ (213, 161, 178),
248
+ (212, 161, 179),
249
+ (212, 160, 179),
250
+ (212, 160, 179),
251
+ (212, 160, 179),
252
+ (212, 159, 180),
253
+ (211, 159, 180),
254
+ (211, 159, 180),
255
+ (211, 159, 180),
256
+ (211, 158, 181),
257
+ (211, 158, 181),
258
+ (210, 158, 181),
259
+ (210, 157, 181),
260
+ (210, 157, 182),
261
+ (210, 157, 182),
262
+ (209, 156, 182),
263
+ (209, 156, 182),
264
+ (209, 156, 183),
265
+ (209, 155, 183),
266
+ (209, 155, 183),
267
+ (208, 155, 183),
268
+ (208, 155, 184),
269
+ (208, 154, 184),
270
+ (208, 154, 184),
271
+ (208, 154, 184),
272
+ (207, 153, 185),
273
+ (207, 153, 185),
274
+ (207, 153, 185),
275
+ (207, 152, 185),
276
+ (207, 152, 186),
277
+ (206, 152, 186),
278
+ (206, 151, 186),
279
+ (206, 151, 186),
280
+ (206, 151, 187),
281
+ (205, 151, 187),
282
+ (205, 150, 187),
283
+ (205, 150, 187),
284
+ (205, 150, 188),
285
+ (205, 149, 188),
286
+ (204, 149, 188),
287
+ (204, 149, 188),
288
+ (204, 148, 189),
289
+ (204, 148, 189),
290
+ (204, 148, 189),
291
+ (203, 147, 189),
292
+ (203, 147, 190),
293
+ (203, 147, 190),
294
+ (203, 146, 190),
295
+ (202, 146, 190),
296
+ (202, 146, 191),
297
+ (202, 146, 191),
298
+ (202, 145, 191),
299
+ (202, 145, 191),
300
+ (201, 145, 192),
301
+ (201, 144, 192),
302
+ (201, 144, 192),
303
+ ]
@@ -6,7 +6,7 @@ from typing import Optional
6
6
  import pandas as pd
7
7
  from graphdatascience import Graph, GraphDataScience
8
8
 
9
- from .pandas import from_dfs
9
+ from .pandas import _from_dfs
10
10
  from .visualization_graph import VisualizationGraph
11
11
 
12
12
 
@@ -35,6 +35,11 @@ def from_gds(
35
35
  """
36
36
  Create a VisualizationGraph from a GraphDataScience object and a Graph object.
37
37
 
38
+ All `additional_node_properties` will be included in the visualization graph.
39
+ If the properties are named as the fields of the `Node` class, they will be included as top level fields of the
40
+ created `Node` objects. Otherwise, they will be included in the `properties` dictionary.
41
+ Additionally, a new "labels" node property will be added, containing the node labels of the node.
42
+
38
43
  Parameters
39
44
  ----------
40
45
  gds : GraphDataScience
@@ -75,9 +80,13 @@ def from_gds(
75
80
 
76
81
  node_props_df = pd.concat(node_dfs.values(), ignore_index=True, axis=0).drop_duplicates()
77
82
  if size_property is not None:
83
+ if "size" in actual_node_properties and size_property != "size":
84
+ node_props_df.rename(columns={"size": "__size"}, inplace=True)
78
85
  node_props_df.rename(columns={size_property: "size"}, inplace=True)
79
86
 
80
87
  for lbl, df in node_dfs.items():
88
+ if "labels" in actual_node_properties:
89
+ df.rename(columns={"labels": "__labels"}, inplace=True)
81
90
  df["labels"] = lbl
82
91
 
83
92
  node_lbls_df = pd.concat([df[["id", "labels"]] for df in node_dfs.values()], ignore_index=True, axis=0)
@@ -88,4 +97,4 @@ def from_gds(
88
97
  rel_df = _rel_df(gds, G)
89
98
  rel_df.rename(columns={"sourceNodeId": "source", "targetNodeId": "target"}, inplace=True)
90
99
 
91
- return from_dfs(node_df, rel_df, node_radius_min_max=node_radius_min_max)
100
+ return _from_dfs(node_df, rel_df, node_radius_min_max=node_radius_min_max, rename_properties={"__size": "size"})