grew_graph.mli 2.57 KB
Newer Older
bguillaum's avatar
bguillaum committed
1
open Grew_ast
2
open Grew_fs
pj2m's avatar
pj2m committed
3 4
open Grew_edge
open Grew_node
bguillaum's avatar
bguillaum committed
5 6
open Grew_utils
open Grew_command
pj2m's avatar
pj2m committed
7 8 9 10 11 12 13 14 15

module Deco: sig
  type t = 
      { nodes: int list;
	edges: (int * Label.t * int) list;
      }
  val empty:t
end

16 17
module P_graph: sig
  type t = P_node.t Pid_map.t
18

pj2m's avatar
pj2m committed
19
  val empty: t
20 21 22 23 24 25
  val find: Pid.t -> t -> P_node.t

  type extension = {
      ext_map: P_node.t Pid_map.t; (* node description for new nodes and for edge "Old -> New"  *)
      old_map: P_node.t Pid_map.t; (* a partial map for new constraints on old nodes "Old [...]" *) 	
    }
pj2m's avatar
pj2m committed
26 27 28 29 30 31

  val build:
      ?domain: Ast.domain -> 
      ?locals: Label.decl array -> 
      Ast.node list -> 
      Ast.edge list -> 
32
	(t * Id.table * (Id.t * Feature_structure.t) list )
pj2m's avatar
pj2m committed
33

34
  val build_extension:
pj2m's avatar
pj2m committed
35 36 37 38 39
      ?domain: Ast.domain -> 
      ?locals: Label.decl array -> 
      Id.table ->
      Ast.node list -> 
      Ast.edge list -> 
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
	(extension * Id.table)

  val roots: t -> Pid.t list

end

module Gid : sig type t = int end

module Gid_map : Map.S with type key = Gid.t 


module G_graph: sig
  type t = {
      map: G_node.t Gid_map.t; (* node description *)
      lub: int;             (* least upper bound *)
    }


  val empty: t
pj2m's avatar
pj2m committed
59

60 61 62 63 64 65 66 67
  val find: Gid.t -> t -> G_node.t

  val build:
      ?domain: Ast.domain -> 
      ?locals: Label.decl array -> 
      Ast.node list -> 
      Ast.edge list -> 
	t
bguillaum's avatar
bguillaum committed
68
  val to_gr: t -> string
69
  val to_dot: ?main_feat:string -> ?deco:Deco.t -> t -> string
pj2m's avatar
pj2m committed
70 71
  val to_dep: ?main_feat:string -> ?deco:Deco.t -> t -> string

72 73 74 75 76 77 78

  type concat_item =
    | Feat of (Gid.t * string)
    | String of string

  val add_edge: t -> int -> G_edge.t -> int -> t option
  val del_edge : ?edge_ident: string -> Loc.t -> t -> int -> G_edge.t -> int -> t
pj2m's avatar
pj2m committed
79 80
  val del_node : t -> int -> t

81
  val add_neighbour : Loc.t -> t -> int -> G_edge.t -> (int * t) 
pj2m's avatar
pj2m committed
82
  val merge_node : Loc.t -> t -> int -> int -> t option
83 84 85

  val shift_in : Loc.t -> t -> int -> int -> t
  val shift_out : Loc.t -> t -> int -> int -> t
pj2m's avatar
pj2m committed
86 87
  val shift_edges : Loc.t -> t -> int -> int -> t

88 89 90 91
  (** [update_feat tar_id tar_feat_name concat_items] sets the feature of the node [tar_id] 
      with feature name [tar_feat_name] to be the contatenation of values described by the [concat_items].
      It returns both the new graph and the new feature value produced as the second element *)
  val update_feat : t -> int -> string -> concat_item list -> (t * string)
pj2m's avatar
pj2m committed
92 93 94

  val del_feat : t -> int -> string -> t

bguillaum's avatar
bguillaum committed
95
  (** [edge_out t id edge] returns true iff there is an out-edge from the node [id] with a label compatible with [edge] *)
96 97 98
  val edge_out: t -> int -> P_edge.t -> bool

  val equals: t -> t -> bool
pj2m's avatar
pj2m committed
99 100 101

end