Skip to main content

Distance Closure on Complex Networks

Project description

Distance Closure on Complex Networks (Network Backbone)

Description

This package implements methods to calculate the Distance Closure of Complex Networks including its Metric and UltraMetric Backbone.

Installation

Latest development release on GitHub (v0.5):

pip install git+https://github.com/CASCI-lab/distanceclosure

Latest PyPI stable release (v0.4.1):

$pip install distanceclosure

Simple usage

How to calculate Closure of a weighted distance graph:

    import networkx as nx
    import distanceclosure as dc

    # Instanciate a (weighted) graph
    edgelist = {
        ('s', 'a'): 8,
        ('s', 'c'): 6,
        ('s', 'd'): 5,
        ('a', 'd'): 2,
        ('a', 'e'): 1,
        ('b', 'e'): 6,
        ('c', 'd'): 3,
        ('c', 'f'): 9,
        ('d', 'f'): 4,
        ('e', 'g'): 4,
        ('f', 'g'): 0,
    }
    G = nx.from_edgelist(edgelist)
    # Make sure every edge has an attribute with the distance value
    nx.set_edge_attributes(G, name='distance', values=edgelist)

    # Compute closure (note this will be a fully connected graph for an undirected connected component. It can be slow for large graphs)
    C = dc.distance_closure(G, kind='metric', weight='distance')

    # You can now access the new `metric_distance` value and whether the edge is part of the metric backbone.
    C['s']['c']
    > {'distance': 6, 'metric_distance': 6, 'is_metric': True}

If you are only interested in the metric backbone itself:

    B = dc.metric_backbone(G, weight='distance')

    B.number_of_edges()
    > 9
    C.number_of_edges()
    > 28
    G.number_of_edges()
    > 11

Papers

  • F.X. Costa, R.B. Correia, L.M. Rocha [2023]. "The distance backbone of directed networks". In: Cherifi, H., Mantegna, R.N., Rocha, L.M., Cherifi, C., Micciche, S. (eds) Complex Networks and Their Applications XI. COMPLEX NETWORKS 2022. Studies in Computational Intelligence, vol 1078. Springer, Cham. doi: 10.1007/978-3-031-21131-7_11

  • T. Simas, R.B. Correia, L.M. Rocha [2021]. "The distance backbone of complex networks". Journal of Complex Networks, 9 (6):cnab021. doi: 10.1093/comnet/cnab021

  • T. Simas and L.M. Rocha [2015]."Distance Closures on Complex Networks". Network Science, 3(2):227-268. doi:10.1017/nws.2015.11

Credits

distanceclosure was originally written by Rion Brattig Correia with input from many others. Thanks to everyone who has improved distanceclosure by contributing code, bug reports (and fixes), documentation, and input on design, and features.

Support

Those who have contributed to distanceclosure have received support throughout the years from a variety of sources. We list them below.

  • CASCI, Binghamton University, Binghamton, NY; PI: Luis M. Rocha
  • CAPES Foundation, Ministry of Education of Brazil, Brasília, Brazil; Rion B. Correia.

Development

Pull requests are welcome :) Please get in touch beforehand: rionbr(at)gmail(dot)com or fcosta(at)binghamton(dot)edu.

Changelog

v0.5

  • Iterative backbone computation (faster for graphs with smaller backbones)

v0.4

  • Code simplification and compliance to NetworkX

v0.3.6

  • Dijkstra Cythonized

v0.3.2

  • S and B measure added to closure

v0.3.0

  • Dijkstra APSP algorithm
  • Support for sparse matrices

v0.2

  • First docs released

v0.1

  • First release nad dense matrix APSP

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

distanceclosure-0.5.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

distanceclosure-0.5-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file distanceclosure-0.5.tar.gz.

File metadata

  • Download URL: distanceclosure-0.5.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for distanceclosure-0.5.tar.gz
Algorithm Hash digest
SHA256 b16c373eba3e60ff462beb5008bb451fe833b102cc35ed778ae4f6f564b20df7
MD5 3a290a09c6b3590343f4fa11b05d8830
BLAKE2b-256 32b78c9cf4cc967232b8c28fbbf61d83cb9fb76a5dcd685c943ecbb2da01eb12

See more details on using hashes here.

File details

Details for the file distanceclosure-0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for distanceclosure-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 376569f379ee004728a587ed4f79bdebf0c1a4a80f7b125d0a948a731d477929
MD5 e875c3dc321b09c7dae33d72049283c7
BLAKE2b-256 2f45f8d21703f87b88c6786bac6d3ef78e4f163d18f51ba031d8fd7f1e537ee0

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