~ubuntu-branches/ubuntu/breezy/ocamlgraph/breezy

« back to all changes in this revision

Viewing changes to oper.mli

  • Committer: Bazaar Package Importer
  • Author(s): Sylvain Le Gall
  • Date: 2005-03-23 23:17:46 UTC
  • mfrom: (2.1.1 hoary)
  • Revision ID: james.westby@ubuntu.com-20050323231746-8rmzgp3zyslg4me5
Tags: 0.90-2
* Transition to ocaml 3.08.3 : depends on ocaml-nox-3.08.3
* Patch 03_META use graph.cma and graph.cmxa ( Closes: #294806 )
* Correct the patch 01_makefile to install graph.a ( Closes: #289138 )

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(*
 
2
 * Graph: generic graph library
 
3
 * Copyright (C) 2004
 
4
 * Sylvain Conchon, Jean-Christophe Filliatre and Julien Signoles
 
5
 * 
 
6
 * This software is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Library General Public
 
8
 * License version 2, as published by the Free Software Foundation.
 
9
 * 
 
10
 * This software is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
13
 * 
 
14
 * See the GNU Library General Public License version 2 for more details
 
15
 * (enclosed in the file LGPL).
 
16
 *)
 
17
 
 
18
(* $Id: oper.mli,v 1.14 2004/11/04 15:39:41 filliatr Exp $ *)
1
19
 
2
20
(** Basic operations over graphs *)
3
21
 
 
22
(** {1 Basic operations over graphs} *)
 
23
 
4
24
module type S = sig
5
25
 
6
26
  type g
37
57
      
38
58
end
39
59
 
40
 
module Make(G : Sig.G)(B : Builder.S with module G = G) : S with type g = G.t
 
60
module Make(B : Builder.S) : S with type g = B.G.t
 
61
  (** Basic operations over graphs *)
41
62
 
42
63
module P(G : Sig.P) : S with type g = G.t
43
64
  (** Basic operations over persistent graphs *)
44
65
 
45
66
module I(G : Sig.I) : S with type g = G.t
46
67
  (** Basic operations over imperative graphs *)
 
68
 
 
69
(** {1 Choose} *)
 
70
 
 
71
(** Choose an element in a graph *)
 
72
module Choose(G : sig 
 
73
                type t 
 
74
                type vertex 
 
75
                type edge 
 
76
                val iter_vertex : (vertex -> unit) -> t -> unit
 
77
                val iter_edges_e : (edge -> unit) -> t -> unit
 
78
              end) :
 
79
sig
 
80
 
 
81
  val choose_vertex : G.t -> G.vertex
 
82
    (** [choose_vertex g] returns a vertex from the graph.
 
83
      @raise Invalid_argument if the graph is empty. *)
 
84
 
 
85
  val choose_edge : G.t -> G.edge
 
86
    (** [choose_edge g] returns an edge from the graph.
 
87
      @raise Invalid_argument if the graph has no edge. *)
 
88
 
 
89
end
 
90
 
 
91
(** {1 Neighbourhood } *)
 
92
 
 
93
(** Neighbourhood of vertex / vertices *)
 
94
module Neighbourhood(G : sig 
 
95
                      type t 
 
96
                      module V : Sig.COMPARABLE
 
97
                      val fold_succ: (V.t -> 'a -> 'a) -> t -> V.t -> 'a -> 'a
 
98
                      val succ: t -> V.t -> V.t list
 
99
                    end) :
 
100
sig
 
101
 
 
102
  module Vertex_Set : Set.S with type elt = G.V.t
 
103
 
 
104
  (** The neighbourhood of a vertex [v] is 
 
105
    \{ v' | (succ g v) and (v <> v') \} *)
 
106
 
 
107
  val list_from_vertex : G.t -> G.V.t -> G.V.t list
 
108
    (** Neighbourhood of a vertex as a list. *)
 
109
 
 
110
  val set_from_vertex : G.t -> G.V.t -> Vertex_Set.t
 
111
    (** Neighbourhood of a vertex as a set. 
 
112
      Less efficient that [list_from_vertex]. *)
 
113
 
 
114
  (** The neighbourhood of a set [S] of vertices is [U \ S] where
 
115
    [U] is the union of neighbourhoods of each vertex of [S]. *)
 
116
 
 
117
  val list_from_vertices : G.t -> G.V.t list -> G.V.t list
 
118
    (** Neighbourhood of a list of vertices as a list. *)
 
119
 
 
120
  val set_from_vertices : G.t -> G.V.t list -> Vertex_Set.t
 
121
    (** Neighbourhood of a list of vertices as a set. 
 
122
      More efficient that [list_from_vertices]. *)
 
123
 
 
124
end