@@ -1303,12 +1303,6 @@ def _recursive_append(parent_name: Optional[str], child_node: T) -> None:
13031303 _node_style = node_style .copy ()
13041304 _edge_style = edge_style .copy ()
13051305
1306- child_label = child_node .node_name
1307- if child_node .path_name not in name_dict [child_label ]: # pragma: no cover
1308- name_dict [child_label ].append (child_node .path_name )
1309- child_name = child_label + str (
1310- name_dict [child_label ].index (child_node .path_name )
1311- )
13121306 if node_attr :
13131307 if isinstance (node_attr , str ) and child_node .get_attr (node_attr ):
13141308 _node_style .update (child_node .get_attr (node_attr ))
@@ -1319,6 +1313,13 @@ def _recursive_append(parent_name: Optional[str], child_node: T) -> None:
13191313 _edge_style .update (child_node .get_attr (edge_attr ))
13201314 elif isinstance (edge_attr , Callable ): # type: ignore
13211315 _edge_style .update (edge_attr (child_node )) # type: ignore
1316+
1317+ child_label = child_node .node_name
1318+ if child_node .path_name not in name_dict [child_label ]: # pragma: no cover
1319+ name_dict [child_label ].append (child_node .path_name )
1320+ child_name = child_label + str (
1321+ name_dict [child_label ].index (child_node .path_name )
1322+ )
13221323 node = pydot .Node (name = child_name , label = child_label , ** _node_style )
13231324 _graph .add_node (node )
13241325 if parent_name is not None :
@@ -1683,7 +1684,7 @@ def _get_attr(
16831684 # Get custom style for root (node_shape_attr, node_attr)
16841685 _parent_node_name = node_shapes [
16851686 _get_attr (_node .parent , node_shape_attr , node_shape )
1686- ].format (label = _node .parent .name )
1687+ ].format (label = _node .parent .node_name )
16871688
16881689 if _get_attr (_node .parent , node_attr , "" ) and len (styles ) < 2 :
16891690 _from_style = _get_attr (_node .parent , node_attr , "" )
@@ -1698,7 +1699,7 @@ def _get_attr(
16981699 _from_style = f":::{ _from_style_class } "
16991700 _node_name = node_shapes [
17001701 _get_attr (_node , node_shape_attr , node_shape )
1701- ].format (label = _node .name )
1702+ ].format (label = _node .node_name )
17021703
17031704 # Get custom style (edge_arrow_attr, edge_label)
17041705 _arrow = edge_arrows [_get_attr (_node , edge_arrow_attr , edge_arrow )]
0 commit comments