Full slides available at http://cs-with-python.github.io/
It would be cool to program some kind of OCR to automatically read the data from the map and produce a data file! But alas, I had to resort to manually creating a data file:
#Station #Neighbour(line)
Acton Town Chiswick Park (District), South Ealing (Picadilly), Turnham Green (Picadilly)
Aldgate Tower Hill (Circle; District), Liverpool Street (Metropolitan; Circle; District)
Aldgate East Tower Hill (District), Liverpool Street (HammersmithCity; Metropolitan)
Alperton Sudbury Town (Picadilly), Park Royal (Picadilly)
graph-tool
¶graph-tool
is a Python library written by Tiago Peixoto that provides a number of tools for analyzing and plotting graphs.graph-tool
?¶from graph_tool.all import Graph
#create a new Graph object
graph_object=Graph()
# add a vertex
vertex1 = graph_object.add_vertex()
vertex2 = graph_object.add_vertex()
# add an edge
edge1 = graph_object.add_edge(vertex1, vertex2)
# create a property map
vertex_names = graph_object.new_vertex_property("string")
## iterate through the vertices in the graph
for vertex in graph_object.vertices():
vertex_names[vertex]="some_name"
from graph_tool.draw import graph_draw
from graph_tool.all import price_network
# draw a small graph
graph_draw(graph_object, output="somefile.png")
#create a price network
price_graph=price_network(5000)
graph_draw(price_graph, output="price.png")
<PropertyMap object with key type 'Vertex' and value type 'vector<double>', for Graph 0x7f27b0121190, at 0x7f277c05cf10>
betweenness
function in graph_tool.centrality
¶from IPython.display import YouTubeVideo
YouTubeVideo('VouLqY-Uegs')
YouTubeVideo('ZKHMtu1eKtc')