def pullnodeIDs(in_network, name_key=u'dn_name'):
 import networkx as nx
 import numpy as np
 from nipype.interfaces.base import isdefined
 if (not isdefined(in_network)):
  raise ValueError
  return None
 try:
  ntwk = nx.read_graphml(in_network)
 except:
  ntwk = nx.read_gpickle(in_network)
 nodedata = ntwk.node
 ids = []
 integer_nodelist = []
 for node in list(nodedata.keys()):
  integer_nodelist.append(int(node))
 for node in np.sort(integer_nodelist):
  try:
   nodeid = nodedata[node][name_key]
  except KeyError:
   nodeid = nodedata[str(node)][name_key]
  ids.append(nodeid)
 return ids

def pullnodeIDs ( in_network , name_key = u'dn_name' ) : import networkx as nx import numpy as np from nipype . interfaces . base import isdefined if ( not isdefined ( in_network ) ) : raise ValueError return None try : ntwk = nx . read_graphml ( in_network ) except : ntwk = nx . read_gpickle ( in_network ) nodedata = ntwk . node ids = [ ] integer_nodelist = [ ] for node in list ( nodedata . keys ( ) ) : integer_nodelist . append ( int ( node ) ) for node in np . sort ( integer_nodelist ) : try : nodeid = nodedata [ node ] [ name_key ] except KeyError : nodeid = nodedata [ str ( node ) ] [ name_key ] ids . append ( nodeid ) return ids
this function will return the values contained .