mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-07 22:11:51 +00:00
community[patch]: Added functions in NetworkxEntityGraph class (#17535)
- **Description:** 1. Added _clear_edges()_ and _get_number_of_nodes()_ functions in NetworkxEntityGraph class. 2. Added the above two function in graph_networkx_qa.ipynb documentation.
This commit is contained in:
@@ -135,6 +135,14 @@ class NetworkxEntityGraph:
|
||||
"""Clear the graph."""
|
||||
self._graph.clear()
|
||||
|
||||
def clear_edges(self) -> None:
|
||||
"""Clear the graph edges."""
|
||||
self._graph.clear_edges()
|
||||
|
||||
def get_number_of_nodes(self) -> int:
|
||||
"""Get number of nodes in the graph."""
|
||||
return self._graph.number_of_nodes()
|
||||
|
||||
def get_topological_sort(self) -> List[str]:
|
||||
"""Get a list of entity names in the graph sorted by causal dependence."""
|
||||
import networkx as nx
|
||||
|
Reference in New Issue
Block a user