langchain.graphs.networkx_graph.NetworkxEntityGraph¶
class langchain.graphs.networkx_graph.NetworkxEntityGraph(graph: Optional[Any] = None)[source]¶
Networkx wrapper for entity graph operations.
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.
draw_graphviz(**kwargs: Any) → None[source]¶
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')
classmethod from_gml(gml_path: str) → NetworkxEntityGraph[source]¶
get_entity_knowledge(entity: str, depth: int = 1) → List[str][source]¶
Get information about an entity.
get_topological_sort() → List[str][source]¶