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
*~
*.cm*
_build/
*.install
bin/dune-project
.merlin
*.o
*.seed
*.data
*.log
*.rif
lib/sasacore/sasaVersion.ml
luretteSession*
*.seed
*.pdf
*.log
*.save
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/
*.dot
*.tgz
*.untracked
rdbg-session*.ml
*.hide
*.md
*.org
*.eps
*.jpg
*.bak
*.dot
_esy/
essais/
esy.lock/
expe-save/
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
*.save
*.lus
*.lut
*.ml
flymd.html
log
node_modules/.cache/
test/async-unison/grid.doth
test/async-unison/grid4.fig
test/async-unison/grid4.jpg
test/async-unison/grid4.ml
test/async-unison/ring.ml
test/async-unison/test_rdbg.ml
test/bfs-spanning-tree/META
test/bfs-spanning-tree/dot2.ml
test/bfs-spanning-tree/luretteSession1/
test/dfs-list/log
test/dfs/x.ml
test/old/
# Created by https://www.gitignore.io/api/vim,code,ocaml,emacs
# Edit at https://www.gitignore.io/?templates=vim,code,ocaml,emacs
### Code ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
### Emacs ###
# -*- 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_*
functions.
......@@ -63,7 +63,7 @@ val get_value_of_string : unit -> (string -> 's) option
val get_copy_value : unit -> ('s -> 's)
val to_string : 's -> string
(** Those are called by sasa once the graph has been parsed *)
val set_card : (unit -> int) -> unit
val set_degrees : (unit -> int*int) -> unit
val set_mean_deg : (unit -> float) -> unit
......
......@@ -5,7 +5,7 @@ open RandomGraph
open GraphGen_arg
open UdgUtils
open Sasacore
open Topology
exception Incorrect_attribute
......@@ -22,6 +22,7 @@ let generate_du_dur graph plan_udg t : unit =
Printf.printf "%f -- %f" t.qudg.radius t.qudg.r1
)
(* Deadcode:
let compute_attr : (Topology.t -> string list -> (string * string) list) =
fun g ->
List.map
......@@ -77,6 +78,8 @@ let compute_attr : (Topology.t -> string list -> (string * string) list) =
get_height g (List.hd (List.tl s))
else raise Incorrect_attribute)
)
*)
let all_attr : (Topology.t -> (string * string) list) =
fun g ->
[ "min_deg", string_of_int
......@@ -94,7 +97,7 @@ let all_attr : (Topology.t -> (string * string) list) =
| None -> (
Printf.eprintf "Computing the max_degree...\n";
flush stderr;
let x = get_degree g in
let x = Topology.get_degree g in
min_max := Some x;
snd x)
| Some x -> snd x);
......@@ -103,7 +106,7 @@ let all_attr : (Topology.t -> (string * string) list) =
| None -> (
Printf.eprintf "Computing the connection...\n";
flush stderr;
let x = is_connected_and_cyclic g in
let x = Topology.is_connected_and_cyclic g in
connected_cyclic := Some x;
fst x)
| Some x -> fst x );
......@@ -112,7 +115,7 @@ let all_attr : (Topology.t -> (string * string) list) =
| None -> (
Printf.eprintf "Computing the cyclicity...\n";
flush stderr;
let x = is_connected_and_cyclic g in
let x = Topology.is_connected_and_cyclic g in
connected_cyclic := Some x;
snd x)
| Some x -> snd x );
......@@ -121,14 +124,14 @@ let all_attr : (Topology.t -> (string * string) list) =
| None -> (
Printf.eprintf "Computing the tree-ness...\n";
flush stderr;
let x = is_connected_and_cyclic g in
let x = Topology.is_connected_and_cyclic g in
connected_cyclic := Some x;
(fst x) && (snd x))
| Some x -> (fst x) && (snd x) );
"links_number", string_of_int (
Printf.eprintf "Computing the link_number...\n";
flush stderr;
get_nb_link g);
Topology.get_nb_link g);
(*
"diameter", string_of_int (
Printf.eprintf "Computing the diameter...\n";
......@@ -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 ->
let attrs_to_string (an,av) = Printf.sprintf "%s=%s" an av in
let graph_attr =
......@@ -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))
in
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
let nodes = String.concat "" (List.map node_to_node_string g.nodes) in
let node_to_link_string n =
let succ = g.succ n.id in
let succ = g.succ n.Topology.id in
let links =
List.map
(fun (w,neighbour) ->
(match w with
| 1 ->
if n.id < neighbour then
Printf.sprintf (" %s -- %s") n.id neighbour
if n.Topology.id < neighbour then
Printf.sprintf (" %s -- %s") n.Topology.id neighbour
else
Printf.sprintf (" %s -- %s") neighbour n.id
| x ->
Printf.sprintf (" %s -- %s [weight=%d]") n.id neighbour x
Printf.sprintf (" %s -- %s") neighbour n.Topology.id
| x ->
Printf.sprintf (" %s -- %s [weight=%d]") n.Topology.id neighbour x
)
)
succ
......@@ -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
let make_dot : (t -> string -> (string * string) list -> unit) =
(*Create a dot file from a graph*)
let make_dot : (Topology.t -> string -> (string * string) list -> unit) =
(* Create a dot file from a graph *)
fun t file_name attrs ->
let name = ref "graph0" in
let oc = if file_name = "" then stdout
......@@ -245,7 +248,7 @@ let () = (
| _ -> (Printf.fprintf stderr "Unexpected outcome. Command line : %s\n"
(String.concat " " (Array.to_list Sys.argv)); assert false)
) in
make_dot g t.outputFile (all_attr g );
make_dot g t.outputFile (all_attr g);
if (t.outputFile <> "" && not t.silent)
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