forked from networkx/networkx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin' into forceatlas2-networkx
- Loading branch information
Showing
14 changed files
with
120 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import networkx as nx | ||
|
||
|
||
class ToNetworkXGraphBenchmark: | ||
params = [nx.Graph, nx.DiGraph] | ||
param_names = ["graph_type"] | ||
|
||
def setup(self, graph_type): | ||
self.edges = [(0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 6)] | ||
|
||
def time_to_networkx_graph_direct(self, graph_type): | ||
_ = nx.to_networkx_graph(self.edges, create_using=graph_type) | ||
|
||
def time_to_networkx_graph_via_constructor(self, graph_type): | ||
_ = graph_type(self.edges) | ||
|
||
### NOTE: Multi-instance checks are explicitly included to cover the case | ||
# where many graph instances are created, which is not uncommon in graph | ||
# analysis. The reason why multi-instance is explicitly probed (rather than | ||
# relying solely on the number of repeats/runs from `timeit` in the benchmark | ||
# suite) is to capture/amplify any distinctions from potential import | ||
# cacheing of the try-excepts in the *same* run | ||
|
||
def time_to_networkx_graph_direct_multi_instance(self, graph_type): | ||
for _ in range(500): # Creating many graph instances | ||
_ = nx.to_networkx_graph(self.edges, create_using=graph_type) | ||
|
||
def time_to_networkx_graph_via_constructor_multi_instance(self, graph_type): | ||
for _ in range(500): # Creating many graph instances | ||
_ = graph_type(self.edges) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
# Generated via tools/generate_requirements.py and pre-commit hook. | ||
# Do not edit this file; modify pyproject.toml instead. | ||
sphinx>=7 | ||
pydata-sphinx-theme>=0.14 | ||
sphinx-gallery>=0.14 | ||
sphinx>=7.3 | ||
pydata-sphinx-theme>=0.15 | ||
sphinx-gallery>=0.16 | ||
numpydoc>=1.7 | ||
pillow>=9.4 | ||
texext>=0.6.7 | ||
myst-nb>=1.0 | ||
myst-nb>=1.1 |