-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproofnxklwrong.py
More file actions
68 lines (41 loc) · 1.47 KB
/
proofnxklwrong.py
File metadata and controls
68 lines (41 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 15 17:54:31 2016
@author: ericburas
"""
import networkx as nx
import kl_connected_subgraph as kl
import numpy as np
#proof that package in network x is not correct
F = nx.read_gml('celegansneural.gml')
G = nx.Graph()
for i in range(0,nx.number_of_nodes(F)):
#print i
for j in range(0,nx.number_of_nodes(F)):
if F.has_edge(i,j):
if not G.has_edge(i,j):
G.add_edge(i,j)
#G = nx.read_edgelist('newmetabolic.txt',nodetype=int)
#
#selflist = G.selfloop_edges()
#for edge in selflist:
# (u,v) = edge
# G.remove_edge(u,v)
P = G.copy()
#get all paths of length 2 and 3
paths = []
for node in P.nodes():
firstneighbors = P.neighbors(node)
for neighbor1 in firstneighbors:
secondneighbors = P.neighbors(neighbor1)
for neighbor2 in secondneighbors:
thirdneighbors = P.neighbors(neighbor2)
paths.append([node,neighbor1,neighbor2])
for neighbor3 in thirdneighbors:
paths.append([node,neighbor1,neighbor2,neighbor3])
for path in paths:
if path[0]==94 and path[-1]==190:
print path
#only 2 edge-disjoint paths: 11-54 11-3-14-54 neural
#P1 = kl.kl_connected_subgraph(G,3,3,low_memory=True,same_as_graph=False)
#38-44 for metabolic