-
Notifications
You must be signed in to change notification settings - Fork 39
/
grami
executable file
·139 lines (128 loc) · 3.25 KB
/
grami
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#default value not to set the maximum number of label appearances
labels=-1
#default value for bounded distance threshold
distance=1
#default value for approximation, no approximation
alpha=1
beta=0
#parse the parameters
while test $# -gt 0; do
case "$1" in
-h|--help)
echo "GraMi help"
echo " "
echo "-h, --help show brief help"
echo "-f, graph filename (*.lg)"
echo "-s, minimum frequency"
echo "-t, graph type: 0 for undirected graphs, 1 for directed graph"
echo "-p, mining type: 0 for subgraphs mining, 1 for patterns graph"
echo "-d, distance threshold, only valid for patterns"
echo "-l, maximum number of repetitions allowed for each distinct label in the frequent subgraphs/patterns results"
echo "-approxA, approximation parameter Alpha"
echo "-approxB, approximation parameter Beta"
echo " "
exit 0
;;
-f)
shift
if test $# -gt 0; then
file=$1
fi
shift
;;
-s)
shift
if test $# -gt 0; then
frequency=$1
fi
shift
;;
-t)
shift
if test $# -gt 0; then
type=$1
fi
shift
;;
-p)
shift
if test $# -gt 0; then
patterns=$1
fi
shift
;;
-d)
shift
if test $# -gt 0; then
distance=$1
fi
shift
;;
-l)
shift
if test $# -gt 0; then
labels=$1
fi
shift
;;
-approxA)
shift
if test $# -gt 0; then
alpha=$1
fi
shift
;;
-approxB)
shift
if test $# -gt 0; then
beta=$1
fi
shift
;;
*)
break
;;
esac
done
#printing some output to the users
echo "Dataset: $file"
if [ $type -eq 1 ]
then
echo "[DIRECTED]"
else
echo "[UNDIRECTED]"
fi
if [ $patterns -eq 1 ]
then
echo "Frequenct Pattern Mining, with minimum distance: $distance"
else
echo "Frequent Subgraph Mining"
fi
if [ $labels -eq -1 ]
then
echo "No constraints on labels"
else
echo "Maximum number of label repetition in results: $labels"
fi
echo "Minimum frequency: $frequency"
#specify which application to run and application parameters
#Grami Directed Patterns
if [ $type -eq 1 ] && [ $patterns -eq 1 ]; then
prog="GRAMI_DIRECTED_PATTERNS"
fi
#Grami Directed Subgraphs
if [ $type -eq 1 ] && [ $patterns -eq 0 ]; then
prog="GRAMI_DIRECTED_SUBGRAPHS"
fi
#Grami Undirected Patterns
if [ $type -eq 0 ] && [ $patterns -eq 1 ]; then
prog="GRAMI_UNDIRECTED_PATTERNS"
fi
#Grami Undirected Subgraphs
if [ $type -eq 0 ] && [ $patterns -eq 0 ]; then
prog="GRAMI_UNDIRECTED_SUBGRAPHS"
fi
#Running Grami
echo "Starting GraMi ...";
java -cp ./$prog/bin Dijkstra.main freq=$frequency filename=$file datasetFolder=./Datasets/ distance=$distance type=$type mlabels=false maxLabelAppearance=$labels approximate=$alpha approxConst=$beta
echo "GraMi Finished."