Skip to content

Commit ae54d1a

Browse files
author
Pietro Abate
committed
Minor cleanup in defaultgraphs
- change graph types from ConcreteBiridectional to Concrete (less memory) - remove a bit of stale code
1 parent b936ebc commit ae54d1a

File tree

3 files changed

+11
-33
lines changed

3 files changed

+11
-33
lines changed

Copyright

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
All files that do not carry an explicit copyright notice in its
22
header are:
33

4-
Copyright 2009,2010,2011: Pietro Abate and Université Paris-Diderot.
4+
Copyright 2009-2013: Pietro Abate and Université Paris-Diderot.
5+
Copyright 2013-2016: Pietro Abate and Inria.
56

6-
Licence: see file COPYINGy
7+
Licence: see file COPYING

algo/defaultgraphs.ml

+7-30
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ module SyntacticDependencyGraph = struct
123123

124124
let default_pp = ref CudfAdd.default_pp
125125

126-
module G = Imperative.Digraph.ConcreteBidirectionalLabeled(PkgV)(PkgE)
126+
module G = Imperative.Digraph.ConcreteLabeled(PkgV)(PkgE)
127127
module DotPrinter = struct
128128
module Display = struct
129129
include G
@@ -715,7 +715,7 @@ end
715715

716716
(******************************************************)
717717

718-
(** Integer Imperative Bidirectional Graph *)
718+
(** Integer Imperative Bidirectional Graph. Mainly used in Strong Conflicts *)
719719
module IntPkgGraph = struct
720720

721721
module PkgV = struct
@@ -725,7 +725,7 @@ module IntPkgGraph = struct
725725
let equal = (=)
726726
end
727727

728-
module G = Imperative.Digraph.ConcreteBidirectional(PkgV)
728+
module G = Imperative.Digraph.Concrete(PkgV)
729729
module S = Set.Make(PkgV)
730730
module O = GraphOper(G)
731731

@@ -765,40 +765,17 @@ module IntPkgGraph = struct
765765
end
766766
)
767767

768-
let add_edge transitive graph i j =
769-
let rec adapt k red =
770-
let new_red =
771-
S.fold (fun l acc ->
772-
if k <> l then G.add_edge graph k l;
773-
G.fold_succ (fun m acc' ->
774-
if not (G.mem_edge graph k m)
775-
then S.add m acc'
776-
else acc'
777-
) graph l acc
778-
) red S.empty
779-
in
780-
if S.is_empty new_red then ()
781-
else adapt k new_red
782-
in
783-
begin
768+
let add_edge graph i j =
784769
debug "Adding edge from %d to %d" i j;
785-
G.add_edge graph i j;
786-
if transitive then begin
787-
adapt i (S.singleton j);
788-
G.iter_pred (fun k ->
789-
if not (G.mem_edge graph k j) then
790-
adapt k (S.singleton j)
791-
) graph i
792-
end
793-
end
770+
G.add_edge graph i j
794771

795772
(** add to the graph all conjunctive dependencies of package id *)
796-
let conjdepgraph_int ?(transitive=false) graph univ id =
773+
let conjdepgraph_int graph univ id =
797774
G.add_vertex graph id;
798775
let p = CudfAdd.inttovar univ id in
799776
List.iter (fun vpkgs ->
800777
match CudfAdd.resolve_vpkgs_int univ vpkgs with
801-
|[q] when q <> id -> add_edge transitive graph id q
778+
|[q] when q <> id -> add_edge graph id q
802779
|_ -> ()
803780
) p.Cudf.depends
804781

applications/strong-deps.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ let main () =
7676
if OptParse.Opt.is_set Options.checkonly then begin
7777
let pkglistlist =
7878
List.map (fun ((n,a),c) ->
79-
let (name,filter) = Debian.Debutil.debvpkg to_cudf ((n,a),c) in
79+
let (name,filter) = Pef.Pefcudf.pefvpkg to_cudf ((n,a),c) in
8080
Cudf.lookup_packages ~filter universe name
8181
) (OptParse.Opt.get Options.checkonly)
8282
in

0 commit comments

Comments
 (0)