library colibrilib.negcycle — module ExportFor extraction
module Export497498use int.Int499use list.List500use list.Mem501use array.Array502use NegCycle503use Graph504505let function mk_edge (s d w: int) : edge = { src = s; dst = d; wt = w }506Valid (17ms) (colibri2)507let create () : Graph.t = Graph.create ()508Valid (16ms) (colibri2)509let function size (t: Graph.t) : int = Graph.size t510
Graph.add
Valid (20ms) (colibri2)let add (t: Graph.t) (k: int) (e: edge) : bool513raises { Graph.Bad_length -> k < 0 \/ k > old t.len }514raises { Graph.Bad_vertex -> 0 <= k <= old t.len /\515(e.src < 0 \/ e.dst < 0) }516ensures { result -> exists tc. cut (old t.trail) k tc /\517(t.trail = Cons e tc \/ (t.trail = tc /\ mem e tc)) }518ensures { not result -> cut (old t.trail) k t.trail /\519neg_cycle (outs_map t.trail) (Array.length t.pi) e }520= Graph.add t k e521522end523