-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated docs and added benchmark for node_redundancy
- Loading branch information
1 parent
8e44dee
commit 2858910
Showing
2 changed files
with
28 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from .common import ( | ||
backends, | ||
edge_prob, | ||
Benchmark, | ||
) | ||
import networkx as nx | ||
|
||
# for an unbalanced bipartite random graph | ||
n = [50, 100, 200, 400, 800] | ||
m = [25, 50, 100, 200, 400] | ||
|
||
|
||
class Redundancy(Benchmark): | ||
params = [(backends), (n), (m), (edge_prob)] | ||
param_names = ["backend", "n", "m", "edge_prob"] | ||
|
||
def time_node_redundancy(self, backend, n, m, edge_prob): | ||
G = get_random_bipartite_graph(n, m, edge_prob) | ||
_ = nx.node_redundancy(G, backend=backend) | ||
|
||
|
||
def get_random_bipartite_graph(n, m, p, seed=42, directed=False): | ||
"""Ref. https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.bipartite.generators.random_graph.html""" | ||
return nx.bipartite.random_graph(n, m, p, seed, directed) |
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