wlwardiary / cable2graph

WikiLeaks Cablegate Reference Network Visualization : cables.csv to graph to svg/html5
https://dataporn.tumblr.com
29 stars 3 forks source link

threaded layout #6

Open wlwardiary opened 13 years ago

wlwardiary commented 13 years ago

as suggested by jstray

currently the layout coordinates are created by igraph using the Fruchterman-Reingold force-directed algorithm[1].

https://github.com/wlwardiary/cable2graph/blob/master/g2svg.py#L29

those coordinates are then translated to edges (svg lines) and vertices (svg circle) using a modification of igraph.Graph.write_svg

https://github.com/wlwardiary/cable2graph/blob/master/g2svg.py#L68

igraph also comes with a Reingold-Tilford tree layout 'tree'[1] which might be more useful for the threaded graph with time on one axis.

[1] http://hal.elte.hu/~nepusz/development/igraph/tutorial/tutorial.html#layout-algorithms

wlwardiary commented 13 years ago

once the date values are included in the graph, they can be added to the vertices dictionary.

https://github.com/wlwardiary/cable2graph/blob/master/g2svg.py#L82

another for loop in the svg template could then draw the timeline

https://github.com/wlwardiary/cable2graph/blob/master/svg.tmpl#L56

wlwardiary commented 11 years ago
g2svg.py -l tree 

using reingold_tilford tree layout, see https://github.com/wlwardiary/cable2graph/blob/master/g2svg.py#L160

The node with the oldest timestamp is set as root of the tree. However, the tree is not sorted by date.