@@ -72,7 +72,6 @@ def add_node(self, ext_node_id: int, raise_on_fail: bool = True) -> None:
7272
7373 self ._add_node (ext_node_id )
7474
75-
7675 def delete_node (self , ext_node_id : int , raise_on_fail : bool = True ) -> None :
7776 """Remove a node from the graph.
7877
@@ -94,9 +93,10 @@ def delete_node(self, ext_node_id: int, raise_on_fail: bool = True) -> None:
9493
9594 def add_node_array (self , node_array : NodeArray , raise_on_fail : bool = True ) -> None :
9695 """Add all nodes in the node array to the graph."""
97- ext_node_ids = node_array .id .tolist ()
98- if existing_ids := set (ext_node_ids ).intersection (set (self .external_ids )):
99- raise GraphError (f"{ len (existing_ids )} external node ids already exist!" )
96+ ext_node_ids = node_array ["id" ].tolist ()
97+ if raise_on_fail :
98+ if existing_ids := set (ext_node_ids ).intersection (set (self .external_ids )):
99+ raise GraphError (f"{ len (existing_ids )} external node ids already exist!" )
100100 self ._add_nodes (ext_node_ids )
101101
102102 def delete_node_array (self , node_array : NodeArray , raise_on_fail : bool = True ) -> None :
@@ -150,8 +150,8 @@ def add_branch_array(self, branch_array: BranchArray) -> None:
150150 if not branch_array .size :
151151 return
152152
153- from_node_ids = self ._externals_to_internals (branch_array . from_node .tolist ())
154- to_node_ids = self ._externals_to_internals (branch_array . to_node .tolist ())
153+ from_node_ids = self ._externals_to_internals (branch_array [ " from_node" ] .tolist ())
154+ to_node_ids = self ._externals_to_internals (branch_array [ " to_node" ] .tolist ())
155155 self ._add_branches (from_node_ids , to_node_ids )
156156
157157 def add_branch3_array (self , branch3_array : Branch3Array ) -> None :
0 commit comments