root/misc/kngraph.sh

Revision 972, 0.7 kB (checked in by alpt, 2 years ago)

stuff

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 #!/bin/bash
2 #
3 # kngraph.sh
4 # http://freaknet.org/alpt/src/misc/kngraph.sh
5 #
6 # --
7 # Generates a Complete Graph
8 #
9 # This script depends on Graphviz: http://www.graphviz.org/
10 #
11 # AlpT (@freaknet.org)
12 #
13
14
15 if [ -z "$1" ]
16 then
17         echo "Specify the number of nodes"
18         echo "  ./kngraph.sh 10"
19         exit 1
20 fi
21
22 K=$1
23
24 echo Writing k$K.dot
25 awk "BEGIN { print \"graph G {\"
26              print \"node [color=red, shape=circle, label=\\\"\\\",\" \\
27              \"height=0.1, width=0.1, style=filled]\"
28              for(i=1; i<=$K;i++){for(o=i+1;o<=$K;o++){
29                      if(i==o)continue;
30                      print \"e\" i \" -- \" \"e\"o;
31              }}
32              print \"}\"}" > k$K.dot
33
34
35 echo "Executing 'circo -Tsvg k$K.dot > k$K.svg'"
36 circo -Tsvg k$K.dot > k$K.svg
Note: See TracBrowser for help on using the browser.