Skip to content

Instantly share code, notes, and snippets.

@hepwori
Created July 22, 2013 05:02
Show Gist options
  • Save hepwori/6051376 to your computer and use it in GitHub Desktop.
Save hepwori/6051376 to your computer and use it in GitHub Desktop.
#!/bin/bash
LAYOUT=sfdp
SIZE=300
echo `date`: Producing graph
cat mutual_uoi_follows | perl -ne 's/(\w+)\t(\w+)/"\1"\t->\t"\2"/ and print' | samp 1 | graphify > graph.gv
echo `date`: Splitting out largest connected component
cat graph.gv | ccomps -zX#0 > graph-cc0.gv
echo `date`: Laying out
cat graph-cc0.gv \
| $LAYOUT \
-Gbgcolor=black \
-Ncolor=transparent \
-Ecolor=gray20 \
-Earrowsize=0 \
-Gsize=$SIZE \
-Gratio=fill \
-Nfontcolor=white \
-Nfontsize=10 \
-Nfontname=Helvetica \
-Nwidth=1 \
-Nheight=0.3 \
-Nfixedsize=true \
-Nstyle=filled \
-Nshape=ellipse \
> layout.gv
echo `date`: Coloring
cat layout.gv \
| ./color music "color=red, fillcolor=red, fontcolor=black" \
| ./color news "color=blue, fillcolor=blue, fontcolor=black" \
| ./color sports "color=yellow, fillcolor=yellow, fontcolor=black" \
| ./color tv "color=green, fillcolor=green, fontcolor=black" \
| ./color govt "color=purple, fillcolor=purple, fontcolor=black" \
> colored-layout.gv
echo `date`: Rendering
cat colored-layout.gv \
| neato -q -s -n1 -Tpng \
-Goutputorder=edgesfirst \
-Gsplines=false \
-Goverlap=false \
> mutual_uoi_follows.png
echo `date`: Done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment