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:
Raunak
2024-02-15 00:32:24 +05:30
committed by GitHub
parent bfaa8c3048
commit 685d62b032
2 changed files with 38 additions and 3 deletions

View File

@@ -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