Commit e2a996e
committed
Improve performance for _has_node
- Networkx represents graphs as a dictionary where the nodes are the
keys. As such, we can use the built-in __contains__ function for fast
lookup
- We can also iterate the graphs directly without constructing a
NodeView using self._graph.nodes()1 parent 54f5029 commit e2a996e
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
912 | 912 | | |
913 | 913 | | |
914 | 914 | | |
915 | | - | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
916 | 918 | | |
917 | 919 | | |
918 | | - | |
| 920 | + | |
919 | 921 | | |
920 | 922 | | |
921 | 923 | | |
| |||
0 commit comments