Aug-11-2021, 01:12 PM
Greetings Community,
I would like to override a function of the library of networkx that is not included in
More specifically:
Could you possibly explain to me which ways I have to achieve my goal and how they are executed correctly?
Thank you very much in advance.
Kind regards,
Weird
I would like to override a function of the library of networkx that is not included in
__all__
.More specifically:
import networkx as nx def geometric_edges(G, radius, p): return [] ... nx.generators.geometric.geometric_edges = geometric_edges return nx.random_geometric_graph(number, radius, pos=pos)I also tried:
import networkx as nx from unittest.mock import patch as patch def geometric_edges(G, radius, p): return [] ... patch("nx.generators.geometric.geometric_edges", geometric_edges) return nx.random_geometric_graph(number, radius, pos=pos)Both attempts did fail so the original function will still be executed instead of the replacement returning an empty list which should lead to an unconnected graph.
Could you possibly explain to me which ways I have to achieve my goal and how they are executed correctly?
Thank you very much in advance.
Kind regards,
Weird