Statistics
| Branch: | Revision:

root / custompackages / graph-parser / src / script.sh @ f9e3a1f0

History | View | Annotate | Download (1.79 KB)

1
## TUTORIAL:
2
## The script take 2 command-line arguments:
3
## $1: specify whether to calculate betweenness centrality as an unweighted graph (false) or weighted graph (true). This argument is for both Heuristic BC and Brandes BC
4
## $2: specify whether to include targets when calculating betweenness centrality (for the Brandes BC)
5

    
6
## If no argument is supplied, then the default is "./script.sh true true"
7

    
8
#########
9
## YOU CAN MODIFY THIS PART
10
#########
11
# Change the variables to run the Betweenness Centrality for weighted or unweighted graph.
12
if [ -z "$1" ] # No argument supplied
13
then
14
    WEIGHTED_GRAPH="true"; # 2 possible values: [true | false]
15
else
16
    WEIGHTED_GRAPH="$1";
17
fi
18

    
19
if [ -z "$2" ] # No argument supplied
20
then
21
   TARGETS_INCLUSION="true"; # 2 possible values: [true | false]
22
else
23
    TARGETS_INCLUSION="$1";
24
fi
25

    
26
#########
27
## TRY TO AVOID MODIFYING ANYTHING BELOW THIS LINE
28
#########
29
## Compile the source code
30
make
31

    
32
## Create output directories if they are not existed
33
declare -a dir_arr=("../output" "../output/visualization")
34
for i in "${dir_arr[@]}"
35
do
36
    echo $i;
37
    if [ ! -d $i ]; then
38
        mkdir $i;
39
    fi
40
done
41

    
42
filepath="../input/simple.edges"
43
input_type=1
44
## Running the script
45
./graph-parser $filepath $input_type $WEIGHTED_GRAPH $TARGETS_INCLUSION
46

    
47
## Plotting the results
48
if [ $WEIGHTED_GRAPH = "true" ]
49
then
50
    SUFFIX="weighted"; # the suffix used in the filename
51
else
52
    SUFFIX="unweighted";
53
fi
54

    
55
## declare an array variables
56
declare -a arr=("simple" "ninux_unweighted_connected" "ninux_30_1" "jsoninfo_topo" "olsr-netjson")
57

    
58
# loop through the array and format the option for gnuplot
59
# gnuplot -e "FILENAME='simple'; SUFFIX='$SUFFIX'" plot_BC_comparison.gp
60
for i in "${arr[@]}"
61
do
62
    option="FILENAME='"$i"_"$SUFFIX"'; SUFFIX='$SUFFIX'";
63
    gnuplot -e "$option" plot_BC_comparison.gp
64
done