Module Sasacore.Topology

Topology: internal representation of Graphs

type node_id = string
type node = {
  1. id : node_id;
    (*

    The id of the node as stated in the dot file

    *)
  2. file : string;
    (*

    the content of the algo field (a ml file)

    *)
  3. init : string;
    (*

    store the content of the init field

    *)
}
type t = {
  1. nodes : node list;
  2. pred : node_id -> (int * node_id) list;
    (*

    get neighbors, with weight

    *)
  3. succ : node_id -> node_id list;
  4. of_id : node_id -> node;
  5. directed : bool;
    (*

    true if the graph is directed

    *)
  6. attributes : (string * string) list;
    (*

    (name, value) list of graph attributes

    *)
}
val read : string -> t

Parse a sasa dot file

Various eponymous util functions

val to_adjacency : t -> bool array array
val to_distance : t -> int array array
val diameter : t -> int
val get_mean_degree : t -> float
val is_connected : t -> bool
val is_cyclic : t -> bool
val is_rooted_tree : t -> bool
val is_tree : t -> bool
val is_in_tree : t -> bool
val is_out_tree : t -> bool
val get_height : t -> string -> int
val get_level : t -> string -> int
val get_parent : t -> string -> int option
val get_subtree_size : t -> string -> int
val get_degree : t -> int * int
val reply : t -> string -> string -> int

reply g p p_neighbor returns the channel number that let p_neighbor access to the content of p, if p is a neighbor of p_neighbor. Returns -1 if p is not a neighbor of p_neighbor, which can happen in directed graphs.