Skip to content
Extraits de code Groupes Projets
Valider d50010f3 rédigé par Thomas MESLIN's avatar Thomas MESLIN
Parcourir les fichiers

Updated makefile test format and clean files

parent 4f58d651
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Fichier supprimé
Fichier supprimé
Fichier supprimé
caml_file := coef_to_csv csv
caml_need_csv := point_assos_to_gephi graph_export
caml_to_run := coef_to_csv. point_assos_to_gephi. graph_export.
all: init $(caml_file) $(caml_need_csv) complete_compile $(caml_to_run) complete_run clean
gefx_to_test := mynetwork
all: compile run clean test
compile: init $(caml_file) $(caml_need_csv) complete_compile
init:
@echo "\nStart to compile all caml programs\n"
$(caml_file):
cd script/src;ocamlopt $@.ml -o ../bin/$@.exe
......@@ -16,6 +18,11 @@ $(caml_need_csv):
complete_compile:
@echo "\nAll caml programs compiled !\n"
run: init_run $(caml_to_run) complete_run
init_run:
@echo "Running files..."
$(caml_to_run):
@echo ""
cd script/bin;./$@exe
......@@ -26,11 +33,19 @@ complete_run:
clean:
@echo "Cleaning file."
cd script/src;rm -v *.cmx *.o
@echo "File cleaned.\n"
test: init_test $(gefx_to_test) end_test
init_test:
@echo "Testing gefx file format"
$(gefx_to_test):
@echo "testing $@.gefx"
@cd test_format;xmllint --noout --schema gexf.xsd ../res_script/$@.gexf
end_test:
@echo "All gefx have been tested\nTest Completed\n"
......
......@@ -18,7 +18,14 @@ let create_gexf path node_data edge_data =
</meta>\n");
(*End_HEADER*)
(*Start graph*)
output_string oc " <graph>\n";
output_string oc " <graph defaultedgetype=\"undirected\">\n";
(*Ajout de la categorie*)
output_string oc
" <attributes class=\"node\">
<attribute id=\"0\" title=\"cat\" type=\"string\">
<default>Eleve</default>
</attribute>
</attributes>\n";
(*start nodes*)
output_string oc " <nodes>\n";
......@@ -28,7 +35,19 @@ let create_gexf path node_data edge_data =
let id = Hashtbl.find htab "Id" in
let label = Hashtbl.find htab "Label" in
let cat = Hashtbl.find htab "Categorie" in
let nouvelle_ligne = Printf.sprintf " <node id=\"%s\" label=\"%s\"/>\n" id label in
let nouvelle_ligne =
if cat = "Eleve" then
Printf.sprintf " <node id=\"%s\" label=\"%s\"/>\n" id label
else
Printf.sprintf
" <node id=\"%s\" label=\"%s\">
<attvalues>
<attvalue for=\"0\" value=\"%s\"/>
</attvalues>
</node>\n" id label cat
in
output_string oc nouvelle_ligne
);
......@@ -43,9 +62,8 @@ let create_gexf path node_data edge_data =
let id = Hashtbl.find htab "Id" in
let src = Hashtbl.find htab "Source" in
let tgt = Hashtbl.find htab "Target" in
let edge_type = if (Hashtbl.find htab "Type").[0] = 'U' then "undirected" else "directed" in
let weight = Hashtbl.find htab "Weight" in
let nouvelle_ligne = Printf.sprintf " <edge id=\"%s\" source=\"%s\" target=\"%s\" type=\"%s\" weight=\"%s\"/>\n" id src tgt edge_type weight in
let nouvelle_ligne = Printf.sprintf " <edge id=\"%s\" source=\"%s\" target=\"%s\" weight=\"%s\"/>\n" id src tgt weight in
output_string oc nouvelle_ligne
);
......@@ -69,7 +87,7 @@ let () = begin
(*Id,Label,Categorie*)
let edge_data = Csv.open_as_csv "../../res_script/edges_avec_fantome.csv" in
(*Source,Target,Type,Id,Weight*)
create_gexf "../src/mynetwork.gexf" node_data edge_data;
create_gexf "../../res_script/mynetwork.gexf" node_data edge_data;
......
Ce diff est replié.
Fichier déplacé
Fichier déplacé
Fichier déplacé
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter