Revision d5b7a27f custompackages/graphparser/src/script.sh
custompackages/graphparser/src/script.sh  

1 
## TUTORIAL: 

2 
## The script take 2 commandline 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 
######### 

1  29 
make 
2 
../bin/main 

3  
4 
# visualization 

5 
echo "Start plotting"; 

6 
gnuplot e "FILENAME='simple.edges.out'" plot_BC_comparison.gp 

7 
gnuplot e "FILENAME='ninux_unweighted_connected.edges.out'" plot_BC_comparison.gp 

8 
gnuplot e "FILENAME='ninux_30_1.edges.out'" plot_BC_comparison.gp 

9 
gnuplot e "FILENAME='jsoninfo_topo.json.out'" plot_BC_comparison.gp 

10 
gnuplot e "FILENAME='olsrnetjson.json.out'" plot_BC_comparison.gp 

11 
echo "Done with plotting" 

30  
31 
## Remove all the previous output 

32 
# rm ../output/*.out 

33  
34 
## Running the script 

35 
../bin/main $WEIGHTED_GRAPH $TARGETS_INCLUSION 

36  
37 
## Plotting the results 

38 
if [ $WEIGHTED_GRAPH = "true" ] 

39 
then 

40 
SUFFIX="weighted"; # the suffix used in the filename 

41 
else 

42 
SUFFIX="unweighted"; 

43 
fi 

44  
45 
## declare an array variables 

46 
declare a arr=("simple" "ninux_unweighted_connected" "ninux_30_1" "jsoninfo_topo" "olsrnetjson") 

47  
48 
# loop through the array and format the option for gnuplot 

49 
# gnuplot e "FILENAME='simple'; SUFFIX='$SUFFIX'" plot_BC_comparison.gp 

50 
for i in "${arr[@]}" 

51 
do 

52 
option="FILENAME='"$i"_"$SUFFIX"'; SUFFIX='$SUFFIX'"; 

53 
gnuplot e "$option" plot_BC_comparison.gp 

54 
done 
Also available in: Unified diff