-
Notifications
You must be signed in to change notification settings - Fork 108
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
Generate Barabasi-Albert Graphs #105
Open
tomatitito
wants to merge
26
commits into
aysylu:master
Choose a base branch
from
tomatitito:barabasi-albert
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instead of degree, which then had to be divided by two. That required making sure we have an even number, which now is not neccessary anymore.
The function takes the number of nodes, a probability and a seed and returns a vector of additional nodes as described in Newman and Watts (1999).
Functional composition of gen-circle and add-shortcuts.
So far only the clustering coefficient for a single node can be computed.
As described in Watts and Strogatz (1998). This is really the average over all clustering coefficients.
Because of this, the function is not variadic anymore.
This is the preferential attachment graph. Remove to old initializing function and start with two connected nodes, to which a new one will attach with equal probability. First test checks for the number of nodes created and passes.
Either explicitly pass a random seed when creating the graph, or use System/nanoTime.
Test if function actually constructs a loom graph and for number of nodes and edges.
Sometimes Node or Edge count are lower than expected. This is because the construction of the graph involves probabilistic decisions. Because of this, test if actual number is bigger than some percentage of the expected count.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a function to generate small-world graphs as proposed by Barabasi and Albert (1999), also know as preferential attachment graphs or power law graphs, as well as some tests. Please let me know, if you see any problems with the code.