Example #1
0
def read_taz(directory, file_prefix):
    taz = mx.graph_from_txt(nodes_file_name=directory + '/' + file_prefix +
                            '_nodes.txt',
                            nid='id',
                            sep='\t')
    print str(len(taz.nodes())) + ' nodes added to TAZ connector network'
    return taz
def read_streets(directory, file_prefix):
	"""convenience function to quickly read in the street network 
	
	Args:
		directory (str): the directory in which to find the street network node and edge files
		file_prefix (str): the file prefix of the node and edge files
	
	Returns:
		networkx.DiGraph(): the street network. 
	"""
	streets = mx.graph_from_txt(nodes_file_name = directory + '/' + file_prefix +'_nodes.txt', 
						   edges_file_name = directory + '/' + file_prefix +'_edges.txt', 
						   sep = ' ', 
						   nid = 'id', 
						   eidfrom = 'source', 
						   eidto = 'target')

	print str(len(streets.nodes())) + ' nodes added to street network'
	print str(len(streets.edges())) + ' edges added to street network.'
	
	return streets
def read_metro(directory, file_prefix):
	"""convenience function to quickly read in and clean the metro network
	
	Args:
		directory (str): the location in which to find the node and edge files
		file_prefix (TYPE): the prefix of the node and edge files
	
	Returns:
		networkx.DiGraph(): the metro network
	"""
	metro = mx.graph_from_txt(nodes_file_name = directory + '/' + file_prefix +'_nodes.txt', 
						   edges_file_name = directory + '/' + file_prefix +'_edges.txt', 
						   sep = '\t', 
						   nid = 'Station', 
						   eidfrom = 'From', 
						   eidto = 'To')

	print str(len(metro.nodes())) + ' nodes added to metro network'
	print str(len(metro.edges())) + ' edges added to metro network.'
	
	return metro
Example #4
0
def read_metro(directory, file_prefix):
    """convenience function to quickly read in and clean the metro network
	
	Args:
		directory (str): the location in which to find the node and edge files
		file_prefix (TYPE): the prefix of the node and edge files
	
	Returns:
		networkx.DiGraph(): the metro network
	"""
    metro = mx.graph_from_txt(
        nodes_file_name=directory + '/' + file_prefix + '_nodes.txt',
        edges_file_name=directory + '/' + file_prefix + '_edges.txt',
        sep='\t',
        nid='Station',
        eidfrom='From',
        eidto='To')

    print str(len(metro.nodes())) + ' nodes added to metro network'
    print str(len(metro.edges())) + ' edges added to metro network.'

    return metro
Example #5
0
def read_streets(directory, file_prefix):
    """convenience function to quickly read in the street network 
	
	Args:
		directory (str): the directory in which to find the street network node and edge files
		file_prefix (str): the file prefix of the node and edge files
	
	Returns:
		networkx.DiGraph(): the street network. 
	"""
    streets = mx.graph_from_txt(
        nodes_file_name=directory + '/' + file_prefix + '_nodes.txt',
        edges_file_name=directory + '/' + file_prefix + '_edges.txt',
        sep=' ',
        nid='id',
        eidfrom='source',
        eidto='target')

    print str(len(streets.nodes())) + ' nodes added to street network'
    print str(len(streets.edges())) + ' edges added to street network.'

    return streets
def read_taz(directory, file_prefix):
	taz = mx.graph_from_txt(nodes_file_name = directory + '/' + file_prefix +'_nodes.txt',
	                             nid = 'id',
	                             sep = '\t')
	print str(len(taz.nodes())) + ' nodes added to TAZ connector network'
	return taz