netsiphd / netrw Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
It's not a big deal for now but ultimately we'll want to be able to set seeds for the rewiring algorithms. I see a few possibilities for this:
random
, and set the seed using random.seed($SEED)
. I don't like this because it mutates global state.Generator
object. This is probably preferable but a bit heavy (and tricky for users).random.Random
as an attribute, and call that to generate random numbers.np.random.Generator
.I think #3 could look like the following:
class BaseRewirer:
<...>
def __init__(seed: Optional[int] = None):
self.rand = random.Random(seed)
<...>
def rewire(self, G, **kwargs):
# selecting a random edge
rand_edge = rand.choice(list(G.edges))
<...>
The challenge with using np.random.Generator
is that numpy randomness wants to return arrays, which we don't always want (e.g., when sampling edges).
I believe that there are a couple of issues with the algorithm:
It is unclear if the method is for directed or undirected networks. For instance, imagine that the network is undirected and the link (0,1) exists. The set potential_edges will contain the edge (1,0). Then, one may destroy (0,1) and create (1,0), wasting one rewiring. Or one may destroy (0,2) and add (1,0) when (0,1) already exists. If the method is meant for undirected networks one way to fix this would be to use permutations rather than itertools product.
The method should "go through each edge in the original network in turn and with probability alpha we remove it and replace it". The current implementation only checks one link. If the function is called |E| number of times, it is not guaranteed that each time a different edge will be checked.
In conversations, there are a few constraints that are possible to test:
DiGraph
, you shouldn't get Graph
back).In general, these algorithms are going to be highly nondeterministic, which presents a challenge for testing them. But ideally we can come up with some things that cover most rewirers (even if we have to have exceptions).
For example, we have copy_graph=True vs. copy_network=True. Additionally, what are we calling timesteps? Etc.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.