Skip to main content

SRIC and LRIC indices calculation

Project description

SLRIC package drawing

SLRIC is a Python package for influence assessment in networks using short-range interaction centrality (SRIC) and long-range interaction centrality (LRIC) indices.

SRIC and LRIC indices take into account:

  • Individual attributes of nodes: threshold of influence (quota), nodes size, etc.;
  • Possiblity of the group influence;
  • Indirect connections between nodes.
Example:
SLRIC features
  • Nodes 2 and 4 have different thresholds of influence (q);
  • Nodes 1 and 2 influence node 4 as a group. Even though node 3 is connected to node 4, it does not influence it directly as node 3 is not a pivotal member in any group;
  • Node 3 influences node 4 via node 2.

Website: https://github.com/SergSHV/slric

Authors: Fuad Aleskerov, Natalia Meshcheryakova, Sergey Shvydun (HSE University, ICS RAS)

Reference: Aleskerov, F., Shvydun, S., & Meshcheryakova, N. (2021). New Centrality Measures in Networks: How to Take into Account the Parameters of the Nodes and Group Influence of Nodes to Nodes (1st ed.). Chapman and Hall/CRC. https://doi.org/10.1201/9781003203421

Installation

Install the package from PyPI:

$ pip install slric

You can also install the latest version from GitHub:

$ pip install git+https://github.com/SergSHV/slric.git

Load SLRIC package:

>>> import slric

SRIC/LRIC Calculation for Simple Example

Generate a network using NetworkX package

>>> import networkx as nx
>>> G = nx.DiGraph()
>>> G.add_edge(1, 4, weight=7)
>>> G.add_edge(2, 4, weight=5)
>>> G.add_edge(3, 4, weight=2)
>>> G.add_edge(3, 2, weight=6) 

Case 1

  • q=60% of weighted in-degree (in percentage);
  • nodes have the same size (size = 1).
>>> slric.sric(G, q=60, size=1) # SRIC 
{1: 0.36363636363636365, 4: 0.0, 2: 0.09740259740259741, 3: 0.538961038961039}

>>> slric.lric(G, q=60, size=1, models='max') # LRIC (Max) 
{1: 0.27450980392156865, 4: 0.0, 2: 0.1470588235294118, 3: 0.5784313725490197}

>>> slric.lric(G, q=60, size=1, models='maxmin') # LRIC (MaxMin)
{1: 0.27450980392156865, 4: 0.0, 2: 0.1470588235294118, 3: 0.5784313725490197}

>>> slric.lric(G, q=60, size=1, models='pagerank') # LRIC (PageRank)
{1: 0.32165639923246203, 4: 0.0, 2: 0.18808528619697315, 3: 0.49025831457056473}

Case 2

  • q=5 for each node (defined quota, dq);
  • nodes have the same size (size = 1).
>>> slric.sric(G, dq=5, size=1) # SRIC
{1: 0.21153846153846154, 4: 0.0, 2: 0.28846153846153844, 3: 0.5}

>>> slric.lric(G, dq=5, size=1, models='max') # LRIC (Max)
{1: 0.25, 4: 0.0, 2: 0.25, 3: 0.5}

Case 3

  • q=5 for node 2, q=10 for node 4;
  • nodes have the same size (size = 1).
>>> d = dict()
>>> d[2] = 5
>>> d[4] = 10

>>> slric.sric(G, dq=d, size=1) # SRIC
{1: 0.2916666666666667, 4: 0.0, 2: 0.20833333333333337, 3: 0.5}

>>> slric.lric(G, dq=d, size=1, models='max') # LRIC (Max)
{1: 0.24137931034482757, 4: 0.0, 2: 0.17241379310344826, 3: 0.5862068965517241}

Write LRIC results to file

>>> from slric import lric, GraphQW
>>> ranking, lric_graph = lric(G, q=60, size=1, models=['max', 'maxmin'], data=TRUE)
>>> GraphQW.write_centrality(lric_graph, 'output.txt', separator=';', mode='w')

Additional features

  1. If nodes size (size) is not defined, then size = weighted out-degree;
  2. Similarly to threshold of influence (q), nodes size can be of dict() type;
  3. Maximal group size can be limited using 'group_size' parameter (by default, group_size=4);
  4. Maximal indirect influence limit can be defined using 'limpath' parameter (by default, limpath=3);
  5. If LRIC version (models) is not defined, then LRIC (Max) is calculated by default (models='max' ).

License

BSD 3-Clause License

Copyright (c) 2019. Fuad Aleskerov, Natalia Meshcheryakova, Sergey Shvydun.

All rights reserved.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slric-1.1.6.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

slric-1.1.6-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file slric-1.1.6.tar.gz.

File metadata

  • Download URL: slric-1.1.6.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for slric-1.1.6.tar.gz
Algorithm Hash digest
SHA256 5d39a6a63834f776797e2d89b1b00710f3265d64c954ffeb0dafbb6f885f1b77
MD5 dd2dacf78984404d5839d3aa79f02771
BLAKE2b-256 7e12881205d955c7118dc8a4b9c4b8f707ca559a8e85c68094317592d067655d

See more details on using hashes here.

File details

Details for the file slric-1.1.6-py3-none-any.whl.

File metadata

  • Download URL: slric-1.1.6-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for slric-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 941995cf99fb30a649908732704e8ef53b5c05200080075ba781eb3df9f5ca73
MD5 e05f0d0d3ef83e7cf320dc5a9f642384
BLAKE2b-256 755ffc76b95847e093497994daa845a337127f60731ac6b1ec670304d5242bed

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page