Skip to content
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

Remove special_targets and other improvements #19

Merged
merged 10 commits into from
Dec 4, 2023
Merged

Remove special_targets and other improvements #19

merged 10 commits into from
Dec 4, 2023

Conversation

mannbach
Copy link
Contributor

@mannbach mannbach commented Dec 4, 2023

This pull request bundles the following improvements:

Initial nodes begin fully connected

By fully connecting the first k nodes, they will start with a degree of k-1. The update rule starts with node k+1 which will connect to all existing k nodes as there are no duplicates allowed. After k+1 joined, all nodes will thus have degree k. This sets the minimum degree to k and avoids isolated nodes.

Improved tests

Test cases are improved to test for minimum degree k, exact number of links and increasing graph clustering when triadic closure is used.

Code simplification

Improved type hints, documentation and removed redundant code.

More importantly, models with triadic closure are simplified. The class netin.TriadicClosure is now responsible for keeping track of triadic closure candidates (898528c) and for performing the actual tc-based target selection. As only triadic closure model variants need to keep track of respective tc candidates, this functionality is now bundled in netin.TriadicClosure and removed from all super classes. Moreover, netin.TriadicClosure makes use of the existing on_edge_added-method to update the candidates.

Whether tc (or another mechanism) is chosen, should be implemented in the actual model implementations. For this purpose, a single base class netin.GraphTC is introduced in b7b8cc3.
This class performs the decision whether tc is executed or whether an alternative mechanism is chosen.
Concrete model variants (e.g., netin.PATCH or netin.TCH) then inherit from netin.GraphTC and only reimplement GraphTC.get_probabilities_regular to specify which exact alternative to triadic closure is performed.

Each of the first `k` nodes will have degree `k-1`.
The first iteration node `k+1` then connects to the previous `k` nodes.
Afterwards, all nodes will have minimum degree `k`.
Also, no node will remain unconnected.
The special targets were a concept only present in triadic closure.
Implementing it in `graph.py` lead to every other class overriding it.

Now, only tc-related classes deal with special targets.
@mannbach mannbach added the enhancement New feature or request label Dec 4, 2023
Copy link
Contributor

@lisette-espin lisette-espin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good. Thanks.

@lisette-espin lisette-espin merged commit 1f0c328 into main Dec 4, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants