MCPcopy Create free account
hub / github.com/ScrapeGraphAI/Scrapegraph-ai / append_node

Method append_node

scrapegraphai/graphs/base_graph.py:378–396  ·  view source on GitHub ↗

Adds a node to the graph. Args: node (BaseNode): The node instance to add to the graph.

(self, node)

Source from the content-addressed store, hash-verified

376 return state, exec_info
377
378 def append_node(self, node):
379 """
380 Adds a node to the graph.
381
382 Args:
383 node (BaseNode): The node instance to add to the graph.
384 """
385
386 # if node name already exists in the graph, raise an exception
387 if node.node_name in {n.node_name for n in self.nodes}:
388 raise ValueError(
389 f"""Node with name '{node.node_name}' already exists in the graph.
390 You can change it by setting the 'node_name' attribute."""
391 )
392
393 last_node = self.nodes[-1]
394 self.raw_edges.append((last_node, node))
395 self.nodes.append(node)
396 self.edges = self._create_edges(set(self.raw_edges))

Callers 1

test_append_nodeMethod · 0.45

Calls 1

_create_edgesMethod · 0.95

Tested by 1

test_append_nodeMethod · 0.36