Networkx wrapper for entity graph operations.
Security note: Make sure that the database connection uses credentials that are narrowly-scoped to only include necessary permissions. Failure to do so may result in data corruption or loss, since the calling code may attempt commands that would result in deletion, mutation of data if appropriately prompted or reading sensitive data if such data is present in the database. The best way to guard against such negative outcomes is to (as appropriate) limit the permissions granted to the credentials used with this tool.
See https://python.langchain.com/docs/security for more information.
Add a triple to the graph.
Delete a triple from the graph.
Get all triples in the graph.
Get information about an entity.
Clear the graph.
Clear the graph edges.
Add node in the graph.
Remove node from the graph.
Return if graph has the given node.
Remove edge from the graph.
Return if graph has an edge between the given nodes.
Return the neighbor nodes of the given node.
Get number of nodes in the graph.
Get a list of entity names in the graph sorted by causal dependence.
Provides better drawing
Usage in a jupyter notebook:
>>> from IPython.display import SVG
>>> self.draw_graphviz_svg(layout="dot", filename="web.svg")
>>> SVG('web.svg')