Partially Attended

an irregularly updated blog by Ian Mulvany

Directed Graph blog setup.

Mon Apr 13, 2009

148 Words
I've decided to use syntaxhiligher2 to do syntax hi-lighting and a call to Yourequations.com for rendering latex on the blog. Bot Cyborg has a good description of how to get this to work on blogger.

The main advantage of this approach is that the pseudo code is written in the blog posts in plain encased in a pre statement, and the equations are also just vanilla latex in a pre statement. So if we wanted to think about the betweenness centrality of a graph we have the equation:

$C_B(v)= \sum_{s \neq v \neq t \in V \atop s \neq t}\frac{\sigma_{st}(v)}{\sigma_{st}}$

and in python for a given graph object we could use the excellent networkx package to calculate it like so

import networkx as nx #import networkxG=nx.read_adjlist("graph.adjlist")  # read in a graph graphnodes_betweenness_centrality = nx.betweenness_centrality(G) # returns a dictionaryfor node_betweenness_centrality in nodes_betweenness_centrality:    print node_betweenness_centrality