-
Notifications
You must be signed in to change notification settings - Fork 173
Add New Preferential Attachment Example #252
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
base: main
Are you sure you want to change the base?
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
for more information, see https://pre-commit.ci
Thanks for another example! Very neat that you keep building things :) @tpike3 and @quaquel: This example is using the new discrete network space, curious what you think! @Sahil-Chhoker and/or @sanika-n could (one of) you review the visualization (implementation)? @Spartan-71 I’m curious, when building these example buildings, were there any Mesa features you were missing, felt counterintuitive or could be improved? |
Ohky will try to get the same in mesa by the end of the day. |
chosen_node = np.random.choice(nodes, p=probabilities) | ||
|
||
# add the new node and connect it to the choosen node | ||
self.graph.add_edge(chosen_node, self.curr_node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work. You merely add a link in the graph that is used as the basis for the Network space. However, this additional edge in the graph won't be reflected in the Network space.
In fact, dynamic networks are not possible at the moment with discrete space because discrete spaces rely on caching their connections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Spartan-71 With the release of 3.2 and @quaquel' work, we have the ability to have dynamic space if you want to take a look for this example.
Summary
This PR introduces a new Preferential Attachment simulation example, inspired by the Barabási–Albert model of network growth. The simulation models how a network evolves over time as new nodes are added and preferentially attach to existing nodes with higher degrees, leading to the emergence of scale-free network structures.
Features
Implementation Details
Network
grid to embed and manage the graph.networkx
for graph data structure and operations.DataCollector
to track key metrics like node degrees.Visualization