package ocamlgraph

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Classic.ISource

Classic Imperative Graphs

Parameters

module G : Sig.I with type V.label = int

Signature

Sourcetype graph = G.t
Sourcetype vertex = G.V.t
Sourceval divisors : int -> graph

divisors n builds the graph of divisors. Vertices are integers from 2 to n. i is connected to j if and only if i divides j.

Sourceval de_bruijn : int -> graph

de_bruijn n builds the de Bruijn graph of order n. Vertices are bit sequences of length n (encoded as their interpretation as binary integers). The sequence xw is connected to the sequence wy for any bits x and y and any bit sequence w of length n-1.

Sourceval vertex_only : int -> graph

vertex_only n builds a graph with n vertices and no edge.

Sourceval full : ?self:bool -> int -> graph

full n builds a graph with n vertices and all possible edges. The optional argument self indicates if loop edges should be added (default value is true).

Sourceval cycle : int -> graph * vertex array

cycle n builds a graph that is a cycle with n vertices. Vertices are labelled with 0,1,...,n-1 and there is an edge from vertex i to vertex (i+1) mod n. Vertices are also returned in an array for convenience.

Sourceval grid : n:int -> m:int -> graph * vertex array array

grid n m builds a grid graph with n*m vertices, with edges from vertex (i,j) to vertices (i+1,j) and (i,j+1) (and no wrapping around). Vertex (i,j) is labelled with i*m+j. Vertices are also returned in a n*m matrix for convenience.

Sourceval kneser : n:int -> k:int -> graph

kneser n k builds the Kneser graph K(n, k), where vertices correspond to the k-element subsets of a set of n elements, and where two vertices are adjacent if and only if the two corresponding sets are disjoint.

Each vertex is labeled with a n-bit integer with exactly k bits set (bit i indicates the selection of the i-th element).

Sourceval petersen : unit -> graph

petersen () builds the Petersen graph, that is isomorphic to the Kneser graph K(5,2).