langchain_community.graphs.networkx_graph.NetworkxEntityGraph¶
class langchain_community.graphs.networkx_graph.NetworkxEntityGraph(graph: Optional[Any] = None)[source]¶
Networkx wrapper for entity graph operations.
Security note: Make sure that the database connection uses credentialsthat 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.
Create a new graph.
Methods
__init__([graph])
Create a new graph.
add_triple(knowledge_triple)
Add a triple to the graph.
clear()
Clear the graph.
delete_triple(knowledge_triple)
Delete a triple from the graph.
draw_graphviz(**kwargs)
Provides better drawing
from_gml(gml_path)
get_entity_knowledge(entity[, depth])
Get information about an entity.
get_topological_sort()
Get a list of entity names in the graph sorted by causal dependence.
get_triples()
Get all triples in the graph.
write_to_gml(path)
__init__(graph: Optional[Any] = None) → None[source]¶
Create a new graph.
add_triple(knowledge_triple: KnowledgeTriple) → None[source]¶
Add a triple to the graph.
clear() → None[source]¶
Clear the graph.
delete_triple(knowledge_triple: KnowledgeTriple) → None[source]¶
Delete a triple from the graph.