Skip to main content

computes the general topological overlap matrix of an undirected network

Project description

This package takes an undirected unweighted scipy.sparse adjacency matrix as an input and computes the GTOM(m) method, using m+1-step neighbors (1). It’s highly efficient and can be used for parallel computation by calling the function for only few nodes at a time.

(1) *Gene network interconnectedness and the generalized topological overlap measure*, A. M. Yip and S. Horvath, BMC Bioinformatics 2007 8:22


$ pip install gtom


Recreating Panels a and c of Figure 3 of the technical report [1]:


import matplotlib.pyplot as pl
import networkx as nx
from gtom import gtom
import scipy.sparse as sprs
import numpy as np

edges = [(0,1),(1,2),(0,3),(0,4),(0,5),(0,7),
G = nx.Graph()

pos = nx.spring_layout(G)
labels = { n:str(n+1) for n in G.nodes()}

N = G.number_of_nodes()
edges = np.array(edges,dtype=int)
A = sprs.csc_matrix((np.ones((edges.shape[0],)),(edges[:,0],edges[:,1])),dtype=float,shape=(N,N))
A += A.T

print("recreate results from figure 3 in [1]")
print("       |\t(i,j)=(1,2)\t(i,j)=(1,3)\t(i,j)=(2,3)")
for m in range(3):
    T = gtom(A,m)
    print(" m = %d |\t%f\t%f\t%f" %(m,T[0,1],T[0,2],T[1,2]))

Project details

Download files

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

Files for gtom, version 0.5
Filename, size File type Python version Upload date Hashes
Filename, size gtom-0.5.tar.gz (4.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page