nsdlib


Namensdlib JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/damianfraszczak/nsdlib
SummaryNetwork source detection library
upload_time2024-11-20 10:03:18
maintainerNone
docs_urlNone
authorDamian Frąszczak, Edyta Frąszczak
requires_pythonNone
licenseMIT
keywords propagation-source-detection outbreaks-detection propagation-reconstruction complex-networks
VCS
bugtrack_url
requirements networkx netcenlib cdlib leidenalg infomap
Travis-CI No Travis.
coveralls test coverage
            # NSDlib

NSDlib (Network source detection library) is a comprehensive library designed for detecting sources of propagation in networks. This library offers a variety of algorithms that help researchers and developers analyze and identify the origins of information (epidemic etc.) spread within networks.

## Overview

NSDLib is a complex library designed for easy integration into existing projects. It aims to be a comprehensive repository
of source detection methods, outbreak detection techniques, and propagation graph reconstruction tools. Researchers worldwide are encouraged to contribute and utilize this library,
facilitating the development of new techniques to combat misinformation and improve propagation analysis.
Each  year, new techniques are introduced through scientific papers, often with only pseudo-code descriptions, making it
difficult for researchers to evaluate and compare them with existing methods. NSDlib tries to bridge this gap and enhance researchers to put their implementations here.

## Code structure

All custom implementations are provided under `nsdlib/algorithms` package. Each method is implemented in a separate file, named after the method itself and in appropriate package according to its intended purpose e.g. reconstruction algorithm should be placed in `reconstruction` package. . Correspondingly, each file contains a function, named identically to the file, which does appropriate logic.  Ultimately, every custom implementation is made available through the `nsdlib/algorithms` package.
## Implemented features:

### Node evaluation algorithms
- [algebraic_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.algebraic_centrality.html)
- [average_distance_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.average_distance_centrality.html)
- [barycenter_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.barycenter_centrality.html)
- [betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.betweenness_centrality.html)
- [bottle_neck_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.bottle_neck_centrality.html)
- [centroid_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.centroid_centrality.html)
- [closeness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.closeness_centrality.html)
- [cluster_rank_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.cluster_rank_centrality.html)
- [communicability_betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.communicability_betweenness_centrality.html)
- [coreness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.coreness_centrality.html)
- [current_flow_betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.current_flow_betweenness_centrality.html)
- [current_flow_closeness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.current_flow_closeness_centrality.html)
- [decay_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.decay_centrality.html)
- [degree_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.degree_centrality.html)
- [diffusion_degree_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.diffusion_degree_centrality.html)
- [dynamic_age](https://nsdlib.readthedocs.io/en/latest/source/nsdlib.algorithms.evaluation.dynamic_age.html#nsdlib.algorithms.evaluation.dynamic_age.dynamic_age)
- [eccentricity_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.eccentricity_centrality.html)
- [eigenvector_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.eigenvector_centrality.html)
- [entropy_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.entropy_centrality.html)
- [geodestic_k_path_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.geodestic_k_path_centrality.html)
- [group_betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.group_betweenness_centrality.html)
- [group_closeness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.group_closeness_centrality.html)
- [group_degree_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.group_degree_centrality.html)
- [harmonic_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.harmonic_centrality.html)
- [heatmap_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.heatmap_centrality.html)
- [hubbell_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.hubbell_centrality.html)
- [jordan_center](https://nsdlib.readthedocs.io/en/latest/source/nsdlib.algorithms.evaluation.jordan_center.html)
- [katz_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.katz_centrality.html)
- [laplacian_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.laplacian_centrality.html)
- [leverage_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.leverage_centrality.html)
- [lin_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.lin_centrality.html)
- [load_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.load_centrality.html)
- [mnc_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.mnc_centrality.html)
- [net_sleuth](https://nsdlib.readthedocs.io/en/latest/source/nsdlib.algorithms.evaluation.net_sleuth.html#nsdlib.algorithms.evaluation.net_sleuth.net_sleuth)
- [pagerank_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.pagerank_centrality.html)
- [pdi_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.pdi_centrality.html)
- [percolation_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.percolation_centrality.html)
- [radiality_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.radiality_centrality.html)
- [rumor_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.rumor_centrality.html)
- [second_order_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.second_order_centrality.html)
- [semi_local_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.semi_local_centrality.html)
- [subgraph_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.subgraph_centrality.html)
- [topological_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.topological_centrality.html)
- [trophic_levels_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.trophic_levels_centrality.html)
- [algebraic_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.algebraic_centrality.html)
- [average_distance_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.average_distance_centrality.html)
- [barycenter_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.barycenter_centrality.html)
- [betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.betweenness_centrality.html)
- [bottle_neck_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.bottle_neck_centrality.html)
- [centroid_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.centroid_centrality.html)
- [closeness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.closeness_centrality.html)
- [cluster_rank_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.cluster_rank_centrality.html)
- [communicability_betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.communicability_betweenness_centrality.html)
- [coreness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.coreness_centrality.html)
- [current_flow_betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.current_flow_betweenness_centrality.html)
- [current_flow_closeness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.current_flow_closeness_centrality.html)
- [decay_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.decay_centrality.html)
- [degree_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.degree_centrality.html)
- [diffusion_degree_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.diffusion_degree_centrality.html)
- [eccentricity_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.eccentricity_centrality.html)
- [eigenvector_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.eigenvector_centrality.html)
- [entropy_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.entropy_centrality.html)
- [geodestic_k_path_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.geodestic_k_path_centrality.html)
- [group_betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.group_betweenness_centrality.html)
- [group_closeness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.group_closeness_centrality.html)
- [group_degree_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.group_degree_centrality.html)
- [harmonic_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.harmonic_centrality.html)
- [heatmap_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.heatmap_centrality.html)
- [hubbell_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.hubbell_centrality.html)
- [katz_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.katz_centrality.html)
- [laplacian_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.laplacian_centrality.html)
- [leverage_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.leverage_centrality.html)
- [lin_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.lin_centrality.html)
- [load_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.load_centrality.html)
- [mnc_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.mnc_centrality.html)
- [pagerank_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.pagerank_centrality.html)
- [pdi_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.pdi_centrality.html)
- [percolation_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.percolation_centrality.html)
- [radiality_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.radiality_centrality.html)
- [rumor_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.rumor_centrality.html)
- [second_order_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.second_order_centrality.html)
- [semi_local_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.semi_local_centrality.html)
- [subgraph_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.subgraph_centrality.html)
- [topological_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.topological_centrality.html)
- [trophic_levels_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.trophic_levels_centrality.html)

### Outbreak detection algorithms
- [CPM_Bipartite](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.CPM_Bipartite.html)
- [agdl](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.agdl.html)
- [angel](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.angel.html)
- [aslpaw](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.aslpaw.html)
- [async_fluid](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.async_fluid.html)
- [bayan](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.bayan.html)
- [belief](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.belief.html)
- [bimlpa](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.bimlpa.html)
- [coach](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.coach.html)
- [condor](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.condor.html)
- [conga](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.conga.html)
- [congo](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.congo.html)
- [core_expansion](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.core_expansion.html)
- [cpm](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.cpm.html)
- [dcs](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.dcs.html)
- [demon](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.demon.html)
- [der](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.der.html)
- [dpclus](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.dpclus.html)
- [ebgc](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.ebgc.html)
- [ego_networks](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.ego_networks.html)
- [eigenvector](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.eigenvector.html)
- [em](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.em.html)
- [endntm](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.endntm.html)
- [eva](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.eva.html)
- [frc_fgsn](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.frc_fgsn.html)
- [ga](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.ga.html)
- [gdmp2](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.gdmp2.html)
- [girvan_newman](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.girvan_newman.html)
- [graph_entropy](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.graph_entropy.html)
- [greedy_modularity](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.greedy_modularity.html)
- [head_tail](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.head_tail.html)
- [hierarchical_link_community](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.hierarchical_link_community.html)
- [ilouvain](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.ilouvain.html)
- [infomap](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.infomap.html)
- [infomap_bipartite](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.infomap_bipartite.html)
- [ipca](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.ipca.html)
- [kclique](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.kclique.html)
- [kcut](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.kcut.html)
- [label_propagation](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.label_propagation.html)
- [lais2](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.lais2.html)
- [leiden](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.leiden.html)
- [lemon](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.lemon.html)
- [lfm](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.lfm.html)
- [louvain](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.louvain.html)
- [lpam](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.lpam.html)
- [lpanni](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.lpanni.html)
- [lswl](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.lswl.html)
- [lswl_plus](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.lswl_plus.html)
- [markov_clustering](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.markov_clustering.html)
- [mcode](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.mcode.html)
- [mod_m](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.mod_m.html)
- [mod_r](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.mod_r.html)
- [multicom](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.multicom.html)
- [node_perception](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.node_perception.html)
- [overlapping_seed_set_expansion](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.overlapping_seed_set_expansion.html)
- [paris](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.paris.html)
- [percomvc](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.percomvc.html)
- [principled_clustering](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.principled_clustering.html)
- [pycombo](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.pycombo.html)
- [r_spectral_clustering](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.r_spectral_clustering.html)
- [rb_pots](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.rb_pots.html)
- [rber_pots](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.rber_pots.html)
- [ricci_community](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.ricci_community.html)
- [sbm_dl](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.sbm_dl.html)
- [sbm_dl_nested](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.sbm_dl_nested.html)
- [scan](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.scan.html)
- [siblinarity_antichain](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.siblinarity_antichain.html)
- [significance_communities](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.significance_communities.html)
- [slpa](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.slpa.html)
- [spectral](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.spectral.html)
- [spinglass](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.spinglass.html)
- [surprise_communities](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.surprise_communities.html)
- [threshold_clustering](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.threshold_clustering.html)
- [tiles](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.tiles.html)
- [umstmo](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.umstmo.html)
- [wCommunity](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.wCommunity.html)
- [walkscan](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.walkscan.html)
- [walktrap](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.walktrap.html)

### Graph reconstruction algorithms
- [SbRP](https://nsdlib.readthedocs.io/en/latest/source/nsdlib.algorithms.reconstruction.sbrp.html#nsdlib.algorithms.reconstruction.sbrp.sbrp)

### Ensemble methods
This package provides implementation for easily combining multiple source detection methods into one ensemble method. Use 'EnsembleSourceDetector' with config objects as arguments to create an ensemble method.

## How to use
Library can be installed using pip:

```bash
pip install nsdlib
```

## Code usage

Provided algorithms can be executed in the following ways:

- by utilizing 'SourceDetector' class and configuring it with 'SourceDetectionConfig' object. This approach allows for seamless source detection and result evaluation.

```python
import networkx as nx

from nsdlib.common.models import SourceDetectionConfig
from nsdlib.source_detection import SourceDetector
from nsdlib.taxonomies import NodeEvaluationAlgorithm


G = nx.karate_club_graph()

config = SourceDetectionConfig(
    node_evaluation_algorithm=NodeEvaluationAlgorithm.NETSLEUTH,
)

source_detector = SourceDetector(config)

result, evaluation = source_detector.detect_sources_and_evaluate(G=G,
                                        IG=G, real_sources=[0,33])
print(evaluation)


```

For performing ensemble source detection, use 'EnsembleSourceDetector' class and configure it with 'EnsembleSourceDetectionConfig' object. This approach allows for seamless source detection and result evaluation.

```python

import networkx as nx

from nsdlib.common.models import SourceDetectionConfig, \
    EnsembleSourceDetectionConfig
from nsdlib.source_detection import SourceDetector, EnsembleSourceDetector
from nsdlib.taxonomies import NodeEvaluationAlgorithm, EnsembleVotingType

G = nx.karate_club_graph()

config_netsleuth = SourceDetectionConfig(
    node_evaluation_algorithm=NodeEvaluationAlgorithm.NETSLEUTH,
)

config_degree = SourceDetectionConfig(
    node_evaluation_algorithm=NodeEvaluationAlgorithm.CENTRALITY_DEGREE,
)

ensemble_config = EnsembleSourceDetectionConfig(
    detection_configs=[config_netsleuth, config_degree],
    voting_type=EnsembleVotingType.HARD,
    classifier_weights=[0.5, 0.5],
)

source_detector = EnsembleSourceDetector(ensemble_config)

result, evaluation = source_detector.detect_sources_and_evaluate(G=G,
                                        IG=G, real_sources=[0,33])
print(evaluation)


```

- by importing and using specific method, each method has appropriate prefix to understand what is the purpose of it:

```python
import networkx as nx

import nsdlib as nsd

G = nx.karate_club_graph()
IG = G.copy()
IG.remove_nodes_from([10,15,20,33])
real_sources = [0,8]

EIG = nsd.reconstruction_sbrp(G, IG)

outbreaks = nsd.outbreaks_leiden(EIG)

detected_sources = []
for outbreak in outbreaks.communities:
    outbreak_G = G.subgraph(outbreak)
    nodes_evaluation = nsd.evaluation_jordan_center(outbreak_G)
    outbreak_detected_source = max(nodes_evaluation, key=nodes_evaluation.get)
    print(f"Outbreak: {outbreak}, Detected Source: {outbreak_detected_source}")
    detected_sources.append(outbreak_detected_source)

evaluation = nsd.compute_source_detection_evaluation(
    G=EIG,
    real_sources=real_sources,
    detected_sources=detected_sources,
)
print(evaluation)

```

This method allows you to directly specify the process of source detection, making it easy to do any modifications to standardlogic.

- by using appropriate enum and method for computing desired method:
```python

import networkx as nx

import nsdlib as nsd
from nsdlib import PropagationReconstructionAlgorithm, NodeEvaluationAlgorithm, OutbreaksDetectionAlgorithm

G = nx.karate_club_graph()
IG = G.copy()
IG.remove_nodes_from([10,15,20,33])
real_sources = [0,8]

EIG = nsd.reconstruct_propagation(G, IG, PropagationReconstructionAlgorithm.SBRP)

outbreaks = nsd.identify_outbreaks(EIG, OutbreaksDetectionAlgorithm.LEIDEN)
outbreaks_G = nsd.create_subgraphs_based_on_outbreaks(EIG, outbreaks)
detected_sources = []
for outbreak in outbreaks_G:
    nodes_evaluation = nsd.evaluate_nodes(outbreak, NodeEvaluationAlgorithm.CENTRALITY_AVERAGE_DISTANCE)
    outbreak_detected_source = max(nodes_evaluation, key=nodes_evaluation.get)
    print(f"Outbreak: {outbreak}, Detected Source: {outbreak_detected_source}")
    detected_sources.append(outbreak_detected_source)

evaluation = nsd.compute_source_detection_evaluation(
    G=EIG,
    real_sources=real_sources,
    detected_sources=detected_sources,
)
print(evaluation)
```

This approach is more flexible and allows for the computation of multiple techniques at once or when iterating over multiple methods making it easy to perform analysis of selected set of techniques.


For more examples and details, please refer to the [official documentation](https://nsdlib.readthedocs.io/en/latest/index.html).

## Contributing

For contributing, refer to its [CONTRIBUTING.md](.github/CONTRIBUTING.md) file.
We are a welcoming community... just follow the [Code of Conduct](.github/CODE_OF_CONDUCT.md).

## Maintainers

Project maintainers are:

- Damian Frąszczak
- Edyta Frąszczak

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/damianfraszczak/nsdlib",
    "name": "nsdlib",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "propagation-source-detection outbreaks-detection propagation-reconstruction complex-networks",
    "author": "Damian Fr\u0105szczak, Edyta Fr\u0105szczak",
    "author_email": "damian.fraszczak@wat.edu.pl",
    "download_url": "https://files.pythonhosted.org/packages/ce/1e/230a904f7d440940b81d64485c8bce514bff414cd3df2e96d635faa53f76/nsdlib-0.1.2.tar.gz",
    "platform": null,
    "description": "# NSDlib\n\nNSDlib (Network source detection library) is a comprehensive library designed for detecting sources of propagation in networks. This library offers a variety of algorithms that help researchers and developers analyze and identify the origins of information (epidemic etc.) spread within networks.\n\n## Overview\n\nNSDLib is a complex library designed for easy integration into existing projects. It aims to be a comprehensive repository\nof source detection methods, outbreak detection techniques, and propagation graph reconstruction tools. Researchers worldwide are encouraged to contribute and utilize this library,\nfacilitating the development of new techniques to combat misinformation and improve propagation analysis.\nEach  year, new techniques are introduced through scientific papers, often with only pseudo-code descriptions, making it\ndifficult for researchers to evaluate and compare them with existing methods. NSDlib tries to bridge this gap and enhance researchers to put their implementations here.\n\n## Code structure\n\nAll custom implementations are provided under `nsdlib/algorithms` package. Each method is implemented in a separate file, named after the method itself and in appropriate package according to its intended purpose e.g. reconstruction algorithm should be placed in `reconstruction` package. . Correspondingly, each file contains a function, named identically to the file, which does appropriate logic.  Ultimately, every custom implementation is made available through the `nsdlib/algorithms` package.\n## Implemented features:\n\n### Node evaluation algorithms\n- [algebraic_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.algebraic_centrality.html)\n- [average_distance_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.average_distance_centrality.html)\n- [barycenter_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.barycenter_centrality.html)\n- [betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.betweenness_centrality.html)\n- [bottle_neck_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.bottle_neck_centrality.html)\n- [centroid_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.centroid_centrality.html)\n- [closeness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.closeness_centrality.html)\n- [cluster_rank_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.cluster_rank_centrality.html)\n- [communicability_betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.communicability_betweenness_centrality.html)\n- [coreness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.coreness_centrality.html)\n- [current_flow_betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.current_flow_betweenness_centrality.html)\n- [current_flow_closeness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.current_flow_closeness_centrality.html)\n- [decay_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.decay_centrality.html)\n- [degree_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.degree_centrality.html)\n- [diffusion_degree_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.diffusion_degree_centrality.html)\n- [dynamic_age](https://nsdlib.readthedocs.io/en/latest/source/nsdlib.algorithms.evaluation.dynamic_age.html#nsdlib.algorithms.evaluation.dynamic_age.dynamic_age)\n- [eccentricity_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.eccentricity_centrality.html)\n- [eigenvector_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.eigenvector_centrality.html)\n- [entropy_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.entropy_centrality.html)\n- [geodestic_k_path_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.geodestic_k_path_centrality.html)\n- [group_betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.group_betweenness_centrality.html)\n- [group_closeness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.group_closeness_centrality.html)\n- [group_degree_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.group_degree_centrality.html)\n- [harmonic_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.harmonic_centrality.html)\n- [heatmap_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.heatmap_centrality.html)\n- [hubbell_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.hubbell_centrality.html)\n- [jordan_center](https://nsdlib.readthedocs.io/en/latest/source/nsdlib.algorithms.evaluation.jordan_center.html)\n- [katz_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.katz_centrality.html)\n- [laplacian_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.laplacian_centrality.html)\n- [leverage_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.leverage_centrality.html)\n- [lin_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.lin_centrality.html)\n- [load_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.load_centrality.html)\n- [mnc_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.mnc_centrality.html)\n- [net_sleuth](https://nsdlib.readthedocs.io/en/latest/source/nsdlib.algorithms.evaluation.net_sleuth.html#nsdlib.algorithms.evaluation.net_sleuth.net_sleuth)\n- [pagerank_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.pagerank_centrality.html)\n- [pdi_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.pdi_centrality.html)\n- [percolation_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.percolation_centrality.html)\n- [radiality_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.radiality_centrality.html)\n- [rumor_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.rumor_centrality.html)\n- [second_order_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.second_order_centrality.html)\n- [semi_local_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.semi_local_centrality.html)\n- [subgraph_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.subgraph_centrality.html)\n- [topological_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.topological_centrality.html)\n- [trophic_levels_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.trophic_levels_centrality.html)\n- [algebraic_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.algebraic_centrality.html)\n- [average_distance_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.average_distance_centrality.html)\n- [barycenter_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.barycenter_centrality.html)\n- [betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.betweenness_centrality.html)\n- [bottle_neck_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.bottle_neck_centrality.html)\n- [centroid_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.centroid_centrality.html)\n- [closeness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.closeness_centrality.html)\n- [cluster_rank_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.cluster_rank_centrality.html)\n- [communicability_betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.communicability_betweenness_centrality.html)\n- [coreness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.coreness_centrality.html)\n- [current_flow_betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.current_flow_betweenness_centrality.html)\n- [current_flow_closeness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.current_flow_closeness_centrality.html)\n- [decay_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.decay_centrality.html)\n- [degree_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.degree_centrality.html)\n- [diffusion_degree_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.diffusion_degree_centrality.html)\n- [eccentricity_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.eccentricity_centrality.html)\n- [eigenvector_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.eigenvector_centrality.html)\n- [entropy_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.entropy_centrality.html)\n- [geodestic_k_path_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.geodestic_k_path_centrality.html)\n- [group_betweenness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.group_betweenness_centrality.html)\n- [group_closeness_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.group_closeness_centrality.html)\n- [group_degree_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.group_degree_centrality.html)\n- [harmonic_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.harmonic_centrality.html)\n- [heatmap_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.heatmap_centrality.html)\n- [hubbell_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.hubbell_centrality.html)\n- [katz_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.katz_centrality.html)\n- [laplacian_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.laplacian_centrality.html)\n- [leverage_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.leverage_centrality.html)\n- [lin_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.lin_centrality.html)\n- [load_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.load_centrality.html)\n- [mnc_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.mnc_centrality.html)\n- [pagerank_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.pagerank_centrality.html)\n- [pdi_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.pdi_centrality.html)\n- [percolation_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.percolation_centrality.html)\n- [radiality_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.radiality_centrality.html)\n- [rumor_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.rumor_centrality.html)\n- [second_order_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.second_order_centrality.html)\n- [semi_local_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.semi_local_centrality.html)\n- [subgraph_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.subgraph_centrality.html)\n- [topological_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.topological_centrality.html)\n- [trophic_levels_centrality](https://netcenlib.readthedocs.io/en/latest/source/netcenlib.algorithms.trophic_levels_centrality.html)\n\n### Outbreak detection algorithms\n- [CPM_Bipartite](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.CPM_Bipartite.html)\n- [agdl](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.agdl.html)\n- [angel](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.angel.html)\n- [aslpaw](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.aslpaw.html)\n- [async_fluid](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.async_fluid.html)\n- [bayan](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.bayan.html)\n- [belief](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.belief.html)\n- [bimlpa](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.bimlpa.html)\n- [coach](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.coach.html)\n- [condor](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.condor.html)\n- [conga](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.conga.html)\n- [congo](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.congo.html)\n- [core_expansion](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.core_expansion.html)\n- [cpm](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.cpm.html)\n- [dcs](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.dcs.html)\n- [demon](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.demon.html)\n- [der](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.der.html)\n- [dpclus](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.dpclus.html)\n- [ebgc](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.ebgc.html)\n- [ego_networks](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.ego_networks.html)\n- [eigenvector](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.eigenvector.html)\n- [em](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.em.html)\n- [endntm](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.endntm.html)\n- [eva](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.eva.html)\n- [frc_fgsn](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.frc_fgsn.html)\n- [ga](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.ga.html)\n- [gdmp2](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.gdmp2.html)\n- [girvan_newman](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.girvan_newman.html)\n- [graph_entropy](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.graph_entropy.html)\n- [greedy_modularity](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.greedy_modularity.html)\n- [head_tail](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.head_tail.html)\n- [hierarchical_link_community](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.hierarchical_link_community.html)\n- [ilouvain](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.ilouvain.html)\n- [infomap](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.infomap.html)\n- [infomap_bipartite](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.infomap_bipartite.html)\n- [ipca](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.ipca.html)\n- [kclique](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.kclique.html)\n- [kcut](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.kcut.html)\n- [label_propagation](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.label_propagation.html)\n- [lais2](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.lais2.html)\n- [leiden](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.leiden.html)\n- [lemon](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.lemon.html)\n- [lfm](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.lfm.html)\n- [louvain](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.louvain.html)\n- [lpam](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.lpam.html)\n- [lpanni](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.lpanni.html)\n- [lswl](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.lswl.html)\n- [lswl_plus](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.lswl_plus.html)\n- [markov_clustering](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.markov_clustering.html)\n- [mcode](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.mcode.html)\n- [mod_m](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.mod_m.html)\n- [mod_r](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.mod_r.html)\n- [multicom](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.multicom.html)\n- [node_perception](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.node_perception.html)\n- [overlapping_seed_set_expansion](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.overlapping_seed_set_expansion.html)\n- [paris](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.paris.html)\n- [percomvc](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.percomvc.html)\n- [principled_clustering](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.principled_clustering.html)\n- [pycombo](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.pycombo.html)\n- [r_spectral_clustering](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.r_spectral_clustering.html)\n- [rb_pots](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.rb_pots.html)\n- [rber_pots](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.rber_pots.html)\n- [ricci_community](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.ricci_community.html)\n- [sbm_dl](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.sbm_dl.html)\n- [sbm_dl_nested](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.sbm_dl_nested.html)\n- [scan](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.scan.html)\n- [siblinarity_antichain](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.siblinarity_antichain.html)\n- [significance_communities](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.significance_communities.html)\n- [slpa](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.slpa.html)\n- [spectral](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.spectral.html)\n- [spinglass](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.spinglass.html)\n- [surprise_communities](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.surprise_communities.html)\n- [threshold_clustering](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.threshold_clustering.html)\n- [tiles](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.tiles.html)\n- [umstmo](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.umstmo.html)\n- [wCommunity](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.wCommunity.html)\n- [walkscan](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.walkscan.html)\n- [walktrap](https://cdlib.readthedocs.io/en/latest/reference/generated/cdlib.algorithms.walktrap.html)\n\n### Graph reconstruction algorithms\n- [SbRP](https://nsdlib.readthedocs.io/en/latest/source/nsdlib.algorithms.reconstruction.sbrp.html#nsdlib.algorithms.reconstruction.sbrp.sbrp)\n\n### Ensemble methods\nThis package provides implementation for easily combining multiple source detection methods into one ensemble method. Use 'EnsembleSourceDetector' with config objects as arguments to create an ensemble method.\n\n## How to use\nLibrary can be installed using pip:\n\n```bash\npip install nsdlib\n```\n\n## Code usage\n\nProvided algorithms can be executed in the following ways:\n\n- by utilizing 'SourceDetector' class and configuring it with 'SourceDetectionConfig' object. This approach allows for seamless source detection and result evaluation.\n\n```python\nimport networkx as nx\n\nfrom nsdlib.common.models import SourceDetectionConfig\nfrom nsdlib.source_detection import SourceDetector\nfrom nsdlib.taxonomies import NodeEvaluationAlgorithm\n\n\nG = nx.karate_club_graph()\n\nconfig = SourceDetectionConfig(\n    node_evaluation_algorithm=NodeEvaluationAlgorithm.NETSLEUTH,\n)\n\nsource_detector = SourceDetector(config)\n\nresult, evaluation = source_detector.detect_sources_and_evaluate(G=G,\n                                        IG=G, real_sources=[0,33])\nprint(evaluation)\n\n\n```\n\nFor performing ensemble source detection, use 'EnsembleSourceDetector' class and configure it with 'EnsembleSourceDetectionConfig' object. This approach allows for seamless source detection and result evaluation.\n\n```python\n\nimport networkx as nx\n\nfrom nsdlib.common.models import SourceDetectionConfig, \\\n    EnsembleSourceDetectionConfig\nfrom nsdlib.source_detection import SourceDetector, EnsembleSourceDetector\nfrom nsdlib.taxonomies import NodeEvaluationAlgorithm, EnsembleVotingType\n\nG = nx.karate_club_graph()\n\nconfig_netsleuth = SourceDetectionConfig(\n    node_evaluation_algorithm=NodeEvaluationAlgorithm.NETSLEUTH,\n)\n\nconfig_degree = SourceDetectionConfig(\n    node_evaluation_algorithm=NodeEvaluationAlgorithm.CENTRALITY_DEGREE,\n)\n\nensemble_config = EnsembleSourceDetectionConfig(\n    detection_configs=[config_netsleuth, config_degree],\n    voting_type=EnsembleVotingType.HARD,\n    classifier_weights=[0.5, 0.5],\n)\n\nsource_detector = EnsembleSourceDetector(ensemble_config)\n\nresult, evaluation = source_detector.detect_sources_and_evaluate(G=G,\n                                        IG=G, real_sources=[0,33])\nprint(evaluation)\n\n\n```\n\n- by importing and using specific method, each method has appropriate prefix to understand what is the purpose of it:\n\n```python\nimport networkx as nx\n\nimport nsdlib as nsd\n\nG = nx.karate_club_graph()\nIG = G.copy()\nIG.remove_nodes_from([10,15,20,33])\nreal_sources = [0,8]\n\nEIG = nsd.reconstruction_sbrp(G, IG)\n\noutbreaks = nsd.outbreaks_leiden(EIG)\n\ndetected_sources = []\nfor outbreak in outbreaks.communities:\n    outbreak_G = G.subgraph(outbreak)\n    nodes_evaluation = nsd.evaluation_jordan_center(outbreak_G)\n    outbreak_detected_source = max(nodes_evaluation, key=nodes_evaluation.get)\n    print(f\"Outbreak: {outbreak}, Detected Source: {outbreak_detected_source}\")\n    detected_sources.append(outbreak_detected_source)\n\nevaluation = nsd.compute_source_detection_evaluation(\n    G=EIG,\n    real_sources=real_sources,\n    detected_sources=detected_sources,\n)\nprint(evaluation)\n\n```\n\nThis method allows you to directly specify the process of source detection, making it easy to do any modifications to standardlogic.\n\n- by using appropriate enum and method for computing desired method:\n```python\n\nimport networkx as nx\n\nimport nsdlib as nsd\nfrom nsdlib import PropagationReconstructionAlgorithm, NodeEvaluationAlgorithm, OutbreaksDetectionAlgorithm\n\nG = nx.karate_club_graph()\nIG = G.copy()\nIG.remove_nodes_from([10,15,20,33])\nreal_sources = [0,8]\n\nEIG = nsd.reconstruct_propagation(G, IG, PropagationReconstructionAlgorithm.SBRP)\n\noutbreaks = nsd.identify_outbreaks(EIG, OutbreaksDetectionAlgorithm.LEIDEN)\noutbreaks_G = nsd.create_subgraphs_based_on_outbreaks(EIG, outbreaks)\ndetected_sources = []\nfor outbreak in outbreaks_G:\n    nodes_evaluation = nsd.evaluate_nodes(outbreak, NodeEvaluationAlgorithm.CENTRALITY_AVERAGE_DISTANCE)\n    outbreak_detected_source = max(nodes_evaluation, key=nodes_evaluation.get)\n    print(f\"Outbreak: {outbreak}, Detected Source: {outbreak_detected_source}\")\n    detected_sources.append(outbreak_detected_source)\n\nevaluation = nsd.compute_source_detection_evaluation(\n    G=EIG,\n    real_sources=real_sources,\n    detected_sources=detected_sources,\n)\nprint(evaluation)\n```\n\nThis approach is more flexible and allows for the computation of multiple techniques at once or when iterating over multiple methods making it easy to perform analysis of selected set of techniques.\n\n\nFor more examples and details, please refer to the [official documentation](https://nsdlib.readthedocs.io/en/latest/index.html).\n\n## Contributing\n\nFor contributing, refer to its [CONTRIBUTING.md](.github/CONTRIBUTING.md) file.\nWe are a welcoming community... just follow the [Code of Conduct](.github/CODE_OF_CONDUCT.md).\n\n## Maintainers\n\nProject maintainers are:\n\n- Damian Fr\u0105szczak\n- Edyta Fr\u0105szczak\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Network source detection library",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/damianfraszczak/nsdlib"
    },
    "split_keywords": [
        "propagation-source-detection",
        "outbreaks-detection",
        "propagation-reconstruction",
        "complex-networks"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f2250f35ca37f586500ccd85ec87f30e27705b2325518fbbc1eb50775a09ee11",
                "md5": "1e5600b2e6aac15157cd9f21e104b24c",
                "sha256": "fbceda9a2c1929d8b9f1a6b7210d01712cc739fa570603cf7b91150c69527b4b"
            },
            "downloads": -1,
            "filename": "nsdlib-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1e5600b2e6aac15157cd9f21e104b24c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 23048,
            "upload_time": "2024-11-20T10:03:16",
            "upload_time_iso_8601": "2024-11-20T10:03:16.860348Z",
            "url": "https://files.pythonhosted.org/packages/f2/25/0f35ca37f586500ccd85ec87f30e27705b2325518fbbc1eb50775a09ee11/nsdlib-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ce1e230a904f7d440940b81d64485c8bce514bff414cd3df2e96d635faa53f76",
                "md5": "57bd2a0e39f978d38dbe9b8e9cf5cc1f",
                "sha256": "3065e8793eb8144e61757e4c008a441e452dff7f715e2f72fb4b2c68ac7ce782"
            },
            "downloads": -1,
            "filename": "nsdlib-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "57bd2a0e39f978d38dbe9b8e9cf5cc1f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 22318,
            "upload_time": "2024-11-20T10:03:18",
            "upload_time_iso_8601": "2024-11-20T10:03:18.495016Z",
            "url": "https://files.pythonhosted.org/packages/ce/1e/230a904f7d440940b81d64485c8bce514bff414cd3df2e96d635faa53f76/nsdlib-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-20 10:03:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "damianfraszczak",
    "github_project": "nsdlib",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "networkx",
            "specs": [
                [
                    ">=",
                    "3.0"
                ]
            ]
        },
        {
            "name": "netcenlib",
            "specs": [
                [
                    ">=",
                    "0.2.2"
                ]
            ]
        },
        {
            "name": "cdlib",
            "specs": [
                [
                    ">=",
                    "0.4.0"
                ]
            ]
        },
        {
            "name": "leidenalg",
            "specs": []
        },
        {
            "name": "infomap",
            "specs": []
        }
    ],
    "lcname": "nsdlib"
}
        
Elapsed time: 1.08208s