@@ -234,7 +234,9 @@ def __repr__(self) -> str:
234234 ]
235235 return f"{ self .__class__ .__name__ } ({ self ._graph_info (yields = yield_fields ).to_dict ()} )"
236236
237- def visualize (self , node_count : int = 100 , center_nodes : Optional [List [int ]] = None ) -> Any :
237+ def visualize (
238+ self , node_count : int = 100 , center_nodes : Optional [List [int ]] = None , include_node_properties : List [str ] = None
239+ ) -> Any :
238240 visual_graph = self ._name
239241 if self .node_count () > node_count :
240242 visual_graph = str (uuid4 ())
@@ -256,11 +258,15 @@ def visualize(self, node_count: int = 100, center_nodes: Optional[List[int]] = N
256258 custom_error = False ,
257259 )
258260
261+ node_properties = [pr_prop ]
262+ if include_node_properties is not None :
263+ node_properties .extend (include_node_properties )
264+
259265 result = self ._query_runner .call_procedure (
260266 endpoint = "gds.graph.nodeProperties.stream" ,
261267 params = CallParameters (
262268 graph_name = visual_graph ,
263- properties = [ pr_prop ] ,
269+ properties = node_properties ,
264270 nodeLabels = self .node_labels (),
265271 config = dict (listNodeLabels = True ),
266272 ),
@@ -312,11 +318,17 @@ def visualize(self, node_count: int = 100, center_nodes: Optional[List[int]] = N
312318 label_to_color = {label : self ._random_bright_color () for label in self .node_labels ()}
313319
314320 for _ , node in node_properties_df .iterrows ():
321+ title = f"Node ID: { node ['nodeId' ]} \n Labels: { node ['nodeLabels' ]} "
322+ if include_node_properties is not None :
323+ title += f"\n Node properties:"
324+ for prop in include_node_properties :
325+ title += f"\n { prop } = { node [prop ]} "
326+
315327 net .add_node (
316328 int (node ["nodeId" ]),
317329 value = node [pr_prop ],
318330 color = label_to_color [node ["nodeLabels" ][0 ]],
319- title = str ( node [ "nodeId" ]) ,
331+ title = title ,
320332 )
321333
322334 # Add all the relationships
0 commit comments