Skip to content

Geometric random graphon #103

Description

@dufourc1

Implement the geometric random graph as a graphon.

Naive implementation $O(n^2)$:

def geometric_random_graph(radius):
    return Graphon(lambda x,y: np.abs(x-y) <= radius)

Networkx inspired implementation $O(n)$

uses scipy.spatial and redefine draw function with:

kdtree = sp.spatial.cKDTree(coords)  # Cannot provide generator.
edge_indexes = kdtree.query_pairs(radius, p)
edges = [(nodes[u], nodes[v]) for u, v in sorted(edge_indexes)]
return edges

link to cKDTree from scipy
link to networkx code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions