langchain_experimental.graph_transformers.diffbot.NodesList¶

class langchain_experimental.graph_transformers.diffbot.NodesList[source]¶

Manages a list of nodes with associated properties.

nodes¶

Stores nodes as keys and their properties as values. Each key is a tuple where the first element is the node ID and the second is the node type.

Type

Dict[Tuple, Any]

Methods

__init__()

add_node_property(node, properties)

Adds or updates node properties.

return_node_list()

Returns the nodes as a list of Node objects.

__init__() None[source]¶
add_node_property(node: Tuple[Union[str, int], str], properties: Dict[str, Any]) None[source]¶

Adds or updates node properties.

If the node does not exist in the list, it’s added along with its properties. If the node already exists, its properties are updated with the new values.

Parameters
  • node (Tuple) – A tuple containing the node ID and node type.

  • properties (Dict) – A dictionary of properties to add or update for the node.

return_node_list() List[Node][source]¶

Returns the nodes as a list of Node objects.

Each Node object will have its ID, type, and properties populated.

Returns

A list of Node objects.

Return type

List[Node]