Skip to content

Instantly share code, notes, and snippets.

View jtorrents's full-sized avatar

Jordi Torrents jtorrents

  • Barcelona (Catalonia)
View GitHub Profile
import time
import networkx as nx
from contextlib import contextmanager
@contextmanager
def hidden(G, nodes=None, edges=None):
if nodes is None:
nodes = []
if edges is None:
edges = []
@jtorrents
jtorrents / benchmark_flow.py
Created April 5, 2014 13:41
Benchmark NetworkX maximum flow implementations for connectivity algorithms.
import time
import math
from random import randrange, choice, shuffle
import networkx as nx
from networkx.utils import create_degree_sequence, powerlaw_sequence
def std(x):
#http://stackoverflow.com/questions/1174984/how-to-efficiently-calculate-a-running-standard-deviation
n = float(len(x))
@jtorrents
jtorrents / bipartite_cc_attention.ipynb
Last active August 29, 2015 14:11
draft descriptive analysis attention networks
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import time
from random import randrange, choice, shuffle
import numpy as np
import networkx as nx
from networkx.algorithms import flow
from networkx.utils import create_degree_sequence, powerlaw_sequence
flow_funcs = dict(
bkolmogorov = flow.boykov_kolmogorov,
@jtorrents
jtorrents / .dircolors
Last active June 27, 2017 08:18
my dotfile
# Exact Solarized Dark color theme for the color GNU ls utility.
# Designed for dircolors (GNU coreutils) 5.97
#
# This simple theme was simultaneously designed for these terminal color schemes:
# - Solarized dark (best)
# - Solarized light
# - default dark
# - default light
# with a slight optimization for Solarized Dark.
#