Code Monkey home page Code Monkey logo

disparity-filter-weighted-graphs's Introduction

Disparity filter for weighted graphs

Implementation of the disparity filter from Serrano et al. to extract the backbone of a weighted graph.

Usage

The original graph must be a Graph or DiGraph object from NetworkX .

The optimal value for alpha corresponds to the threshold that minimizes the number of edges while maximizing the number of vertices. Use plot_optimal_alpha() to obtain an illustration.

import disparity_filter_weighted_graphs as dfil
import networkx as nx

# Load the graph from a weighted edgelist.
graph = nx.read_weighted_edgelist('path_to_file', create_using=nx.Graph())

# Compute the 'alpha' value for each edge.
dfil.compute_alpha(graph)

# Find the optimal value for alpha. The dataframe used to find the optimal
#   value for alpha is saved to `finding_optimal_alpha.csv.zip`.
dfil.find_optimal_alpha(graph, save_optimal_alpha_data=True, method='elbow')

# Plot the position of the optimal value for alpha.
dfil.plot_optimal_alpha(graph)

# Create a filtered version of the original graph using the optimal value for alpha.
backbone = dfil.filter_graph(graph)

Reference

Extracting the multiscale backbone of complex weighted networks
M. Á. Serrano, M. Boguñá and A. Vespignani
Proc. Natl. Acad. Sci. U.S.A. 106, 6483-6488 (2009)

disparity-filter-weighted-graphs's People

Contributors

aekpalakorn avatar antoineallard avatar becla18 avatar gainxglobal avatar iaciac avatar malcolmvr avatar

Forkers

becla18

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.