Skip to content
Snippets Groups Projects
Commit a4c98492 authored by Kylian Fontaine's avatar Kylian Fontaine
Browse files

Verification graphe measure acyclique

parent f21a2aee
No related branches found
No related tags found
No related merge requests found
...@@ -295,15 +295,17 @@ end ...@@ -295,15 +295,17 @@ end
module G = Graph.Imperative.Digraph.ConcreteLabeled(Node)(Edge) module G = Graph.Imperative.Digraph.ConcreteLabeled(Node)(Edge)
module Topological = Graph.Topological.Make(G) module Topological = Graph.Topological.Make(G)
module D = Graph.Traverse.Dfs(G)
type edge = type edge =
| Nolab of (expr * expr) | Nolab of (expr * expr)
(**[graph_from_edges el] creates a graph from a list of edges [el] (**[graph_from_edges el] creates a graph from a list of edges [el]
@param edge [list] @param edge [list]
@return [G.t]*) @return [G.t]*)
let graph_from_edges (el : edge list)= let graph_from_edges (el : edge list)=
let g = G.create () in let g = G.create () in
let nolab = fun (x, y) -> let nolab = fun (x, y) ->
let vx = G.V.create x in let vx = G.V.create x in
...@@ -315,7 +317,8 @@ let graph_from_edges (el : edge list)= ...@@ -315,7 +317,8 @@ let graph_from_edges (el : edge list)=
| [] -> () | [] -> ()
| (Nolab h)::t -> nolab h ; add_edge t | (Nolab h)::t -> nolab h ; add_edge t
in add_edge el; in add_edge el;
g if not(D.has_cycle g) then g else raise(Failure("Graph is cyclic"))
(**[png_from_graph g name] generates a png file of the graph [g] (**[png_from_graph g name] generates a png file of the graph [g]
@param g [G.t] @param g [G.t]
...@@ -334,7 +337,7 @@ let png_from_graph g name= ...@@ -334,7 +337,7 @@ let png_from_graph g name=
let oc = open_out ("./generate/"^name^"_measure.dot") in let oc = open_out ("./generate/"^name^"_measure.dot") in
Printf.fprintf oc "%s\n" dot; Printf.fprintf oc "%s\n" dot;
close_out oc; close_out oc;
ignore (Sys.command ("dot -Tpng "^name^".dot -o ./generate/"^ name^"_measure.png")) ignore (Sys.command ("dot -Tpng ./generate/"^name^"_measure.dot -o ./generate/"^ name^"_measure.png"))
(**[assign_heigth g] returns the phase, phase weight association list. The phase weight is deduced from the order (**[assign_heigth g] returns the phase, phase weight association list. The phase weight is deduced from the order
topology of the phase topology of the phase
......
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