Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User story: Computing some graph statistic #31

Open
andsor opened this issue Apr 24, 2016 · 0 comments
Open

User story: Computing some graph statistic #31

andsor opened this issue Apr 24, 2016 · 0 comments

Comments

@andsor
Copy link
Member

andsor commented Apr 24, 2016

import networkx as nx
import simkernel as simk

def compute_average_clustering(n, p, graph):
    return nx.average_clustering(graph)

def generate_graph(n, p, seeds):
    for seed in seeds:
        yield nx.gnp_random_graph(n, p, seed)

xp = simk.Experiment(
    compute_average_clustering
).inputgen(
    graph=generate_graph
).aggregate(
    'seeds', simk.mean
)

res = xp(
    n=[10, 100, 1000],
    p=[0.1, 0.2, 0.3, 0.4, 0.5],
    seeds=range(1000),
)

np.testing.assert_array_equal(np.shape(res), (3, 5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant