Module Graph__Merge.P
Extension for the module G.
Parameters
G : Graph.Sig.P
Signature
val merge_vertex : graph -> vertex list -> graphIf no element of
vlbelongs togthenmerge_vertex g (v::vl)is the graphg. Otherwise the collection of vertices ofmerge_vertex g (v::vl)is the collection of vertices ofgfrom which all the elements ofvlwere removed and to whichvwas added. Any edge ofmerge_vertex g (v::vl)is an edge ofgwhose source (destination) was changed tovif it belongs tovl. The functionmerge_vertexalways returns a graph with a smaller collection of vertices and a smaller collection of edges (in the weak sense). However the labels appearing inmerge_vertex g v::vlare exactly the ones appearing ing.
val merge_edges_e : ?src:vertex -> ?dst:vertex -> graph -> edge list -> graphIf no element of
elbelongs togthenmerge_edges_e g (e::el)is the graphg. Otherwise the collection of vertices ofmerge_edges_e g (e::el)is precisely the collection of vertices ofgfrom which the sources and the destinations of all the elements ofelwere removed and to which the verticesvandwwere added. Ifdstwas provided thenvissrcotherwise it is the source ofe. Ifdstwas provided thenwisyotherwise it is the destination ofe. The collection of edges ofmerge_edges_e g e::elis precisely the collection of edges ofgfrom which all the elements ofelwere removed and to which an edge fromvtowsharing the label ofewas added; the edges ofgbeing understood up to the fact their source and destination were updated. Notev=wif and only if the source of some element ofelmatches the destination of some element ofel(possibly the same).
val merge_edges_with_label : ?src:vertex -> ?dst:vertex -> ?label:edge_label -> graph -> edge_label -> graphThe graph
merge_edges_with_label ?src ?tgt ?label g lis the graphmerge_edges_e ?src ?dst g elwithelbeing the list of all edges ofgcarrying the labell. If the optional valuelabelis provided then the edge to which all the elements ofelare identified carries the labellabel. Otherwise it carries the labell. In particularmerge_edges_with_label ?src ?tgt ?label g lis the graphgif and only if there is at most one edge ofgcarrying the labell.
val merge_isolabelled_edges : graph -> graphThe graph
merge_isolabelled_edges gis obtained fromgby identifying two vertices when they are the sources (destinations) of two edges sharing the same label. Therefore two distinct edges of the returned graph cannot carry the same label. In particular if all the edges share the same label then the returned graph is either empty (ifgis so) or a single vertex (ifghas no edge and at least one vertex) or a single vertex and a single edge (ifghas both a vertex and an edge). A label is carried by some edge ofmerge_isolabelled_edges gif and only if it is carried by some edge ofg.
val merge_ends : ?strict:bool -> ?specified_vertex:vertex -> graph -> graphA vertex
vofgis called an end if every edge ofgarriving tovalso starts fromv. It is called a strict end if no edge ofgarrives to it. The graphmerge_ends gis the graphmerge_vertex vlwherevlis the list of (strict) ends ofg. The vertex substituted to the ends can be specified.
val merge_starts : ?strict:bool -> ?specified_vertex:vertex -> graph -> graphA vertex
vofgis called a start if every edge ofgstarting fromvalso arrives tov. It is called a strict start if no edge ofgstarts from it. The graphmerge_starts gis the graphmerge_vertex vlwherevlis the list of (strict) starts ofg. The vertex substituted to the starts can be specified.
val merge_scc : ?loop_killer:bool -> ?specified_vertex:(vertex list -> vertex) -> graph -> graphThe vertex of every strongly connected component are identified. If the option
loop_killeris set totruethen all the edges between identified vertices are removed. The optionspecified_vertexallows to choose the vertex that replaces the elements of a strongly connected component.