-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
14,574 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: d64ad0606c00d935d6d8a4fb6fab342e | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
Event Handling | ||
============== | ||
|
||
Several other classes implement the :class:`.HasEvents` interface. | ||
In that case, they should provide a :attr:`.HasEvents.EVENTS` list that contains the :class:`Events <.Event>` that they implement. | ||
|
||
If you wish to inject your own code, check :meth:`.HasEvents.register_event_handler`. | ||
As an example, consider the (shortened) implementation of :class:`.SimulationTimer`: | ||
|
||
.. code:: python | ||
class SimulationTimer: | ||
_start_time: float # Starting time | ||
time: Optional[float] = None # Final measure | ||
def __init__(self, model: Model) -> None: | ||
# Start timer with simulation | ||
model.register_event_handler( | ||
Event.SIMULATION_START, self._start_timer) | ||
# End timer with simulation | ||
model.register_event_handler( | ||
Event.SIMULATION_END, self._end_timer) | ||
def _start_timer(self): | ||
# Sets the starting time | ||
self._start_time = time.time() | ||
def _end_timer(self): | ||
# Computes the final simulation run | ||
self.time = time.time() - self._start_time | ||
This code registers two functions to measure the simulation. | ||
When the simulation starts, the :meth:`_start_timer` method is called to store the starting time. | ||
Once the simulation ends, :meth:`_end_timer` takes again the time and subtracts the starting time. | ||
After the simulation, the :attr:`time` attribute contains the runtime of the simulation. | ||
|
||
.. autoclass:: netin.utils.Event | ||
:members: | ||
:undoc-members: | ||
.. autoclass:: netin.utils.HasEvents | ||
:members: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Filters | ||
========== | ||
|
||
.. autoclass:: netin.filters.Filter | ||
:members: | ||
|
||
.. autoclass:: netin.filters.NoDoubleLinks | ||
:members: | ||
|
||
.. autoclass:: netin.filters.NoSelfLinks | ||
:members: | ||
|
||
.. autoclass:: netin.filters.ActiveNodes | ||
:members: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Extending NetIn | ||
=============== | ||
|
||
The package provides multiple interfaces to extend its functionalities. | ||
|
||
Several classes implement the :class:`.HasEvents` interface which can be used to inject your own code at runtime. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
events | ||
|
||
Alternatively, you can extend the existing class structure to facilitate the existing simulation code, changing only specific modeling details. | ||
:class:`.Filter` and :class:`.LinkFormationMechanism` provide abstract classes that describe how target nodes are chosen during simulation. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
filters | ||
mechanisms | ||
|
||
Both custom and existing implementations (e.g., :class:`.Homophily`) can be used in custom models to reuse the existing simulation logic. | ||
In that case, only some of the simulation methods have to be reimplemented. | ||
For this purpose, several abstract base classes define varying levels of modelling abstractions. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
models |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Link Formation Mechanisms (LFM) | ||
=============================== | ||
|
||
.. autoclass:: netin.link_formation_mechanisms.LinkFormationMechanism | ||
:members: | ||
|
||
.. autoclass:: netin.link_formation_mechanisms.Uniform | ||
:members: | ||
|
||
.. autoclass:: netin.link_formation_mechanisms.PreferentialAttachment | ||
:members: | ||
|
||
.. autoclass:: netin.link_formation_mechanisms.InDegreePreferentialAttachment | ||
:members: | ||
|
||
.. autoclass:: netin.link_formation_mechanisms.Homophily | ||
:members: | ||
|
||
.. autoclass:: netin.link_formation_mechanisms.TriadicClosure | ||
:members: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Model | ||
===== | ||
|
||
.. autoclass:: netin.models.Model | ||
:members: | ||
:private-members: | ||
|
||
.. autoclass:: netin.models.BinaryClassModel | ||
:members: | ||
:private-members: | ||
|
||
.. autoclass:: netin.models.UndirectedModel | ||
:members: | ||
:private-members: | ||
|
||
.. autoclass:: netin.models.DirectedModel | ||
:members: | ||
:private-members: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Graphs | ||
======= | ||
|
||
.. autoclass:: netin.graphs.Graph | ||
:members: | ||
:inherited-members: | ||
|
||
.. autoclass:: netin.graphs.DiGraph | ||
:members: | ||
:inherited-members: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
.. NetIn documentation master file, created by | ||
sphinx-quickstart on Wed Apr 19 11:08:02 2023. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
Network Inequality | ||
================================= | ||
|
||
.. automodule:: netin | ||
|
||
Existing models are defined by the following :class:`.Model` class implementations. | ||
|
||
|
||
.. toctree:: | ||
:maxdepth: 3 | ||
|
||
models/index | ||
|
||
Each model can be simulated by running the :meth:`.Model.simulate` method, returning the simulated network as a :class:`.Graph` instance. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
graphs | ||
|
||
:class:`Graphs <.Graph>` typically contain node attributes in the form of :class:`NodeVectors <NodeVector>`. | ||
For most models, these vectors contain the group assignments of nodes to a minority or majority class as :class:`.BinaryClassNodeVector`. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
node_vectors/index | ||
|
||
Besides the implementation of models, `NetIn` offers functionality to analyze existing (or simulated) networks in terms of various inequalities they exhibit. | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
statistics | ||
|
||
If you want to create your own custom models or inject your own code during simulation of existing models, `NetIn` is highly extendible. | ||
It also provides utility functions to visualize networks and inequality results. | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
extensions/index | ||
visualizations | ||
utilities | ||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` | ||
|
||
.. include:: references.rst |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Directed Graph Models | ||
===================== | ||
|
||
.. autoclass:: netin.models.DHModel | ||
:members: | ||
:inherited-members: | ||
|
||
.. autoclass:: netin.models.DPAModel | ||
:members: | ||
:inherited-members: | ||
|
||
.. autoclass:: netin.models.DPAHModel | ||
:members: | ||
:inherited-members: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Models | ||
======= | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:glob: | ||
|
||
directed | ||
undirected |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Undirected Graph Models | ||
======================= | ||
|
||
.. autoclass:: netin.models.BarabasiAlbertModel | ||
:members: | ||
:inherited-members: | ||
|
||
.. autoclass:: netin.models.HomophilyModel | ||
:members: | ||
:inherited-members: | ||
|
||
.. autoclass:: netin.models.PAHModel | ||
:members: | ||
:inherited-members: | ||
|
||
.. autoclass:: netin.models.PATCHModel | ||
:members: | ||
:inherited-members: | ||
|
||
.. autoclass:: netin.models.CompoundLFM | ||
:members: | ||
:inherited-members: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Node vectors | ||
============ | ||
|
||
.. autoclass:: netin.graphs.NodeVector | ||
:members: | ||
:inherited-members: | ||
|
||
.. autoclass:: netin.graphs.CategoricalNodeVector | ||
:members: | ||
:inherited-members: | ||
|
||
.. autoclass:: netin.graphs.BinaryClassNodeVector | ||
:members: | ||
:inherited-members: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
References | ||
========== | ||
|
||
.. Please follow alphabetical ordering | ||
.. [BarabasiAlbert1999] | ||
| A. L. Barabasi and R. Albert "Emergence of scaling in random networks", Science 286, pp 509-512, 1999. | ||
.. [Espin-Noboa2022] | ||
| L. Espín-Noboa, C. Wagner, M. Strohmaier, & F. Karimi "Inequality and inequity in network-based ranking and recommendation algorithms" Scientific reports 12(1), 1-14, 2022. | ||
.. [Espin-Noboa2017] | ||
| L. Espín-Noboa, F. Lemmerich, M. Strohmaier, & P. Singer, P. "JANUS: A hypothesis-driven Bayesian approach for understanding edge formation in attributed multigraphs" Applied Network Science, 2, 1-20. | ||
.. [Karimi2018] | ||
| F. Karimi, M. Génois, C. Wagner, P. Singer, & M. Strohmaier, M "Homophily influences ranking of minorities in social networks", Scientific reports 8(1), 11077, 2018. | ||
.. [Gini] | ||
| `Gini coefficient <http://www.statsdirect.com/help/default.htm#nonparametric_methods/gini.htm>`_ and `Implementation <https://github.com/oliviaguest/gini/blob/master/gini.py>`_ | ||
.. [Yang2017] | ||
| J. Yang, B. Ribeiro, & J. Neville "Should We Be Confident in Peer Effects Estimated From Social Network Crawls?" ICWSM (Vol. 11, No. 1, pp. 708-711), 2017. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Statistics | ||
========== | ||
|
||
.. automodule:: netin.stats.distributions | ||
:members: | ||
|
||
.. automodule:: netin.stats.networks | ||
:members: | ||
|
||
.. automodule:: netin.stats.ranking | ||
:members: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Utility Functions | ||
================= | ||
|
||
.. autoclass:: netin.utils.SimulationTimer | ||
:members: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Visualization | ||
============= | ||
|
||
.. automodule:: netin.viz.handlers | ||
:members: |
Oops, something went wrong.