Skip to main content

Algorithm for finding anomalous groups in networks

Project description

Python package for the CItation-Donor-REcipient (CIDRE) algorithm.

Please cite:

Sadamori Kojaku, Giacomo Livan, Naoki Masuda. Detecting citation cartels in journal networks. arXiv:2009.09097 (2020)

Install

pip install cidre

Minimal example

import cidre

alg = cidre.Cidre(group_membership)
groups = alg.detect(A, threshold = 0.15)
  • group_membership: If the network has communities, and the communities are not anomalous, tell the community membership to CIDRE through this argument, where group_membership[i] indicates the group to which node i belongs. Otherwise, set group_membership=None.
  • A: Adjacency matrix of the input network (can be weighted and directed). nx.Graph or scipy.sparse_matrix. if scipy.sparse_matrix format, A[i,j] indicates the weight of edge from node i to j.
  • threshold: Threshold for the donor and recipient nodes. A larger threshold will yield tighter and smaller groups
  • groups: Detected groups. This is a list of special class, Group.

The donors of group can be obtained by

groups[0].donors # {node_id: donor_score}
  • group.donors is a dict object, with keys and values corresponding to the node ID and the donor score.

Similarly, the recipients of a group together with their recipient scores are given by

group.recipient # {node_id: recipient_score}

Visualization

ax = plt.gca()
dc = cidre.DrawCartel()
dc.draw(group, ax = ax)

The labels beside the nodes are the ID of the nodes, or equivalently row ids of the adjacency matrix A.

To put the node labels, make a dictionary from the ID to label, like node_labels = {0:"name", 1:"name 2"}, and pass it by node_labels = node_labels.

Example script

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

cidre-0.0.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

cidre-0.0.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file cidre-0.0.0.tar.gz.

File metadata

  • Download URL: cidre-0.0.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.6

File hashes

Hashes for cidre-0.0.0.tar.gz
Algorithm Hash digest
SHA256 5ab897f87a0790b7a3d61413d6fc02f46cb04acda886da014e06ef0f3e74350a
MD5 9090e0f7ed78518d09863e093c44fd8d
BLAKE2b-256 b709dd570dac612b71e1c3c6d5888013b8bd30dbe3975061a9a3a7a1a6c77f08

See more details on using hashes here.

File details

Details for the file cidre-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: cidre-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.7.6

File hashes

Hashes for cidre-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 069ce7024c164d28ba52c68943f93dd959d6f08e212b17a0aaf5c7b349f966eb
MD5 4c55f51f5eebab3face6ee69f6e84426
BLAKE2b-256 cfacc2ada1403a3635ba563cfb6d4efcc3e22c1971292d62bfccc3e5183fbcab

See more details on using hashes here.

Supported by

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