Skip to content
Snippets Groups Projects
Commit 936250f3 authored by erwan's avatar erwan
Browse files

Chore: a pass at the .gitignore file + some code refactoring

parent 73f42287
No related branches found
No related tags found
No related merge requests found
*~ *.data
*.cm* *.log
_build/
*.install
bin/dune-project
.merlin
*.o
*.seed
*.rif *.rif
lib/sasacore/sasaVersion.ml luretteSession*
*.seed
*.pdf *.pdf
*.log *.dot
*.save *.tgz
rdbg-session*.ml
*.lut
*.org_archive
Makefile.local
notes.org
sasa-*.dot
*.html
*.pyc
*.json
tools/test/compare_bfs_dfs/DotsTank
tools/test/compare_bfs_dfs/*log
luretteSession.ml
test/debug_sasa/
*.untracked *.untracked
rdbg-session*.ml
*.hide *.hide
*.md
*.org
*.eps
*.jpg
*.bak *.bak
*.dot *.save
_esy/ *.lus
essais/ *.lut
esy.lock/ *.ml
expe-save/ flymd.html
expe/
guides/Makefile
guides/contributors/flymd.md
guides/users/_html/
guides/users/my-rdbg-tuning.ml
guides/users/sasabatch.eps
guides/users/sasabatch.jpg
guides/users/sh/
guides/users/test
log log
node_modules/.cache/
test/async-unison/grid.doth # Created by https://www.gitignore.io/api/vim,code,ocaml,emacs
test/async-unison/grid4.fig # Edit at https://www.gitignore.io/?templates=vim,code,ocaml,emacs
test/async-unison/grid4.jpg
test/async-unison/grid4.ml ### Code ###
test/async-unison/ring.ml .vscode/*
test/async-unison/test_rdbg.ml !.vscode/settings.json
test/bfs-spanning-tree/META !.vscode/tasks.json
test/bfs-spanning-tree/dot2.ml !.vscode/launch.json
test/bfs-spanning-tree/luretteSession1/ !.vscode/extensions.json
test/dfs-list/log
test/dfs/x.ml ### Emacs ###
test/old/ # -*- mode: gitignore; -*-
*~
\#*\#
/.emacs.desktop
/.emacs.desktop.lock
*.elc
auto-save-list
tramp
.\#*
# Org-mode
.org-id-locations
*_archive
# flymake-mode
*_flymake.*
# eshell files
/eshell/history
/eshell/lastdir
# elpa packages
/elpa/
# reftex files
*.rel
# AUCTeX auto folder
/auto/
# cask packages
.cask/
dist/
# Flycheck
flycheck_*.el
# server auth directory
/server/
# projectiles files
.projectile
# directory configuration
.dir-locals.el
# network security
/network-security.data
### OCaml ###
*.annot
*.cmo
*.cma
*.cmi
*.a
*.o
*.cmx
*.cmxs
*.cmxa
# ocamlbuild working directory
_build/
# ocamlbuild targets
*.byte
*.native
# oasis generated files
setup.data
setup.log
# Merlin configuring file for Vim and Emacs
.merlin
# Dune generated files
*.install
# Local OPAM switch
_opam/
# Esy-related generated files
_esy/
_build.prev/
node_modules/
### Vim ###
# Swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Session
Session.vim
Sessionx.vim
# Temporary
.netrwhist
# Auto-generated tag files
tags
# Persistent undo
[._]*.un~
# Coc configuration directory
.vim
# End of https://www.gitignore.io/api/vim,code,ocaml,emacs
(* Time-stamp: <modified the 06/03/2020 (at 10:20) by Erwan Jahier> *) (* Time-stamp: <modified the 09/03/2020 (at 14:19) by Erwan Jahier> *)
(** This module duplicates and extends the Algo module with get_* (** This module duplicates and extends the Algo module with get_*
functions. functions.
...@@ -63,7 +63,7 @@ val get_value_of_string : unit -> (string -> 's) option ...@@ -63,7 +63,7 @@ val get_value_of_string : unit -> (string -> 's) option
val get_copy_value : unit -> ('s -> 's) val get_copy_value : unit -> ('s -> 's)
val to_string : 's -> string val to_string : 's -> string
(** Those are called by sasa once the graph has been parsed *)
val set_card : (unit -> int) -> unit val set_card : (unit -> int) -> unit
val set_degrees : (unit -> int*int) -> unit val set_degrees : (unit -> int*int) -> unit
val set_mean_deg : (unit -> float) -> unit val set_mean_deg : (unit -> float) -> unit
......
...@@ -5,7 +5,7 @@ open RandomGraph ...@@ -5,7 +5,7 @@ open RandomGraph
open GraphGen_arg open GraphGen_arg
open UdgUtils open UdgUtils
open Sasacore open Sasacore
open Topology
exception Incorrect_attribute exception Incorrect_attribute
...@@ -22,6 +22,7 @@ let generate_du_dur graph plan_udg t : unit = ...@@ -22,6 +22,7 @@ let generate_du_dur graph plan_udg t : unit =
Printf.printf "%f -- %f" t.qudg.radius t.qudg.r1 Printf.printf "%f -- %f" t.qudg.radius t.qudg.r1
) )
(* Deadcode:
let compute_attr : (Topology.t -> string list -> (string * string) list) = let compute_attr : (Topology.t -> string list -> (string * string) list) =
fun g -> fun g ->
List.map List.map
...@@ -77,6 +78,8 @@ let compute_attr : (Topology.t -> string list -> (string * string) list) = ...@@ -77,6 +78,8 @@ let compute_attr : (Topology.t -> string list -> (string * string) list) =
get_height g (List.hd (List.tl s)) get_height g (List.hd (List.tl s))
else raise Incorrect_attribute) else raise Incorrect_attribute)
) )
*)
let all_attr : (Topology.t -> (string * string) list) = let all_attr : (Topology.t -> (string * string) list) =
fun g -> fun g ->
[ "min_deg", string_of_int [ "min_deg", string_of_int
...@@ -94,7 +97,7 @@ let all_attr : (Topology.t -> (string * string) list) = ...@@ -94,7 +97,7 @@ let all_attr : (Topology.t -> (string * string) list) =
| None -> ( | None -> (
Printf.eprintf "Computing the max_degree...\n"; Printf.eprintf "Computing the max_degree...\n";
flush stderr; flush stderr;
let x = get_degree g in let x = Topology.get_degree g in
min_max := Some x; min_max := Some x;
snd x) snd x)
| Some x -> snd x); | Some x -> snd x);
...@@ -103,7 +106,7 @@ let all_attr : (Topology.t -> (string * string) list) = ...@@ -103,7 +106,7 @@ let all_attr : (Topology.t -> (string * string) list) =
| None -> ( | None -> (
Printf.eprintf "Computing the connection...\n"; Printf.eprintf "Computing the connection...\n";
flush stderr; flush stderr;
let x = is_connected_and_cyclic g in let x = Topology.is_connected_and_cyclic g in
connected_cyclic := Some x; connected_cyclic := Some x;
fst x) fst x)
| Some x -> fst x ); | Some x -> fst x );
...@@ -112,7 +115,7 @@ let all_attr : (Topology.t -> (string * string) list) = ...@@ -112,7 +115,7 @@ let all_attr : (Topology.t -> (string * string) list) =
| None -> ( | None -> (
Printf.eprintf "Computing the cyclicity...\n"; Printf.eprintf "Computing the cyclicity...\n";
flush stderr; flush stderr;
let x = is_connected_and_cyclic g in let x = Topology.is_connected_and_cyclic g in
connected_cyclic := Some x; connected_cyclic := Some x;
snd x) snd x)
| Some x -> snd x ); | Some x -> snd x );
...@@ -121,14 +124,14 @@ let all_attr : (Topology.t -> (string * string) list) = ...@@ -121,14 +124,14 @@ let all_attr : (Topology.t -> (string * string) list) =
| None -> ( | None -> (
Printf.eprintf "Computing the tree-ness...\n"; Printf.eprintf "Computing the tree-ness...\n";
flush stderr; flush stderr;
let x = is_connected_and_cyclic g in let x = Topology.is_connected_and_cyclic g in
connected_cyclic := Some x; connected_cyclic := Some x;
(fst x) && (snd x)) (fst x) && (snd x))
| Some x -> (fst x) && (snd x) ); | Some x -> (fst x) && (snd x) );
"links_number", string_of_int ( "links_number", string_of_int (
Printf.eprintf "Computing the link_number...\n"; Printf.eprintf "Computing the link_number...\n";
flush stderr; flush stderr;
get_nb_link g); Topology.get_nb_link g);
(* (*
"diameter", string_of_int ( "diameter", string_of_int (
Printf.eprintf "Computing the diameter...\n"; Printf.eprintf "Computing the diameter...\n";
...@@ -138,7 +141,7 @@ let all_attr : (Topology.t -> (string * string) list) = ...@@ -138,7 +141,7 @@ let all_attr : (Topology.t -> (string * string) list) =
] ]
let to_dot_string : (t -> string -> (string * string) list -> string) = let to_dot_string : (Topology.t -> string -> (string * string) list -> string) =
fun g name attrs -> fun g name attrs ->
let attrs_to_string (an,av) = Printf.sprintf "%s=%s" an av in let attrs_to_string (an,av) = Printf.sprintf "%s=%s" an av in
let graph_attr = let graph_attr =
...@@ -146,23 +149,23 @@ let to_dot_string : (t -> string -> (string * string) list -> string) = ...@@ -146,23 +149,23 @@ let to_dot_string : (t -> string -> (string * string) list -> string) =
Printf.sprintf "graph [%s]" (String.concat " " (List.map attrs_to_string attrs)) Printf.sprintf "graph [%s]" (String.concat " " (List.map attrs_to_string attrs))
in in
let node_to_node_string n = let node_to_node_string n =
Printf.sprintf " %s [algo=\"%s\"]\n" n.id n.file Printf.sprintf " %s [algo=\"%s\"]\n" n.Topology.id n.Topology.file
in in
let nodes = String.concat "" (List.map node_to_node_string g.nodes) in let nodes = String.concat "" (List.map node_to_node_string g.nodes) in
let node_to_link_string n = let node_to_link_string n =
let succ = g.succ n.id in let succ = g.succ n.Topology.id in
let links = let links =
List.map List.map
(fun (w,neighbour) -> (fun (w,neighbour) ->
(match w with (match w with
| 1 -> | 1 ->
if n.id < neighbour then if n.Topology.id < neighbour then
Printf.sprintf (" %s -- %s") n.id neighbour Printf.sprintf (" %s -- %s") n.Topology.id neighbour
else else
Printf.sprintf (" %s -- %s") neighbour n.id Printf.sprintf (" %s -- %s") neighbour n.Topology.id
| x -> | x ->
Printf.sprintf (" %s -- %s [weight=%d]") n.id neighbour x Printf.sprintf (" %s -- %s [weight=%d]") n.Topology.id neighbour x
) )
) )
succ succ
...@@ -175,8 +178,8 @@ let to_dot_string : (t -> string -> (string * string) list -> string) = ...@@ -175,8 +178,8 @@ let to_dot_string : (t -> string -> (string * string) list -> string) =
Printf.sprintf "graph %s {\n%s\n%s\n%s\n}\n" name graph_attr nodes links Printf.sprintf "graph %s {\n%s\n%s\n%s\n}\n" name graph_attr nodes links
let make_dot : (t -> string -> (string * string) list -> unit) = let make_dot : (Topology.t -> string -> (string * string) list -> unit) =
(*Create a dot file from a graph*) (* Create a dot file from a graph *)
fun t file_name attrs -> fun t file_name attrs ->
let name = ref "graph0" in let name = ref "graph0" in
let oc = if file_name = "" then stdout let oc = if file_name = "" then stdout
...@@ -245,7 +248,7 @@ let () = ( ...@@ -245,7 +248,7 @@ let () = (
| _ -> (Printf.fprintf stderr "Unexpected outcome. Command line : %s\n" | _ -> (Printf.fprintf stderr "Unexpected outcome. Command line : %s\n"
(String.concat " " (Array.to_list Sys.argv)); assert false) (String.concat " " (Array.to_list Sys.argv)); assert false)
) in ) in
make_dot g t.outputFile (all_attr g ); make_dot g t.outputFile (all_attr g);
if (t.outputFile <> "" && not t.silent) if (t.outputFile <> "" && not t.silent)
then Printf.printf "Done.\nOutput file : '%s'\n" t.outputFile then Printf.printf "Done.\nOutput file : '%s'\n" t.outputFile
) )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment