Random graph models


Random graph models

#r "FSharp.FGL"
#r "FSharp.FGL.ArrayAdjacencyGraph"

open FSharp.FGL
open FSharp.FGL.ArrayAdjacencyGraph
open ArrayAdjacencyGraph.Models

To create random graph models, ArrayAdjacenyGraph includes three different methods:

Gilbert

The gilbert model (or G(N,p) model) was introduced by Edgar Gilbert in 1959. In this model, you assign a fixed amount of vertices N and a probability p. p denotes the probality, that edge between two vertices exists or not.

open Gilbert.Gilbert

//Create a new random graph based on the gilbert graph model
let gilbertRandomGraph : ArrayAdjacencyGraph<int,string,float> =
    gilbert 100 0.1 false (id) (fun x -> sprintf "%i" x) (fun (a,b) -> 1.)

Barabasi-Albert

The Barabasi-Albert model is an algorithm for creating scale-free graphes where on an existing graph n vertices with m edges that are added to the vertex each iteration.

open BarabasiAlbert.BarabasiAlbert

//Take a existing graph (here, the gilbertRandomGraph) and add the specified amount of vertices (50) with at least 5 edges connected to the new vertices
let barabasiAlbertGraph : ArrayAdjacencyGraph<int,string,float> =
    barabasiAlbert gilbertRandomGraph 50 5 (id) (fun x -> sprintf "%i" x) (fun (a,b) -> 1.)

Bollobas-Riordan

The Bollobas-Riordan model, an implementation similar to barabasiAlbert, where the resulting graph can be easily influenced thanks to the three additional parameters.

open Scale_free_graph.BollobasRiordan

//Create a graph following the bollobasRiordan graph model    
let bollobasRiordanGraph : ArrayAdjacencyGraph<int,int,float> =
    bollobasRiordan 100 0.6 0.1 0.3 0.5 0.5 (ArrayAdjacencyGraph())
Multiple items
Namespace FSharp

--------------------
Namespace Microsoft.FSharp
Namespace FSharp.FGL
Namespace FSharp.FGL.ArrayAdjacencyGraph
Multiple items
Namespace FSharp.FGL.ArrayAdjacencyGraph

--------------------
Namespace ArrayAdjacencyGraph

--------------------
type ArrayAdjacencyGraph<'Vertex,'Label,'Edge (requires equality and equality)> =
  private new : vertexEdges:Dictionary<'Vertex,LEdge<'Vertex,'Edge> []> * labels:Dictionary<'Vertex,'Label> -> ArrayAdjacencyGraph<'Vertex,'Label,'Edge> + 2 Überladungen
  member AddEdge : LEdge<'Vertex,'Edge> -> ArrayAdjacencyGraph<'Vertex,'Label,'Edge>
  member AddManyEdges : edgeArray:seq<LEdge<'Vertex,'Edge>> -> ArrayAdjacencyGraph<'Vertex,'Label,'Edge>
  member AddManyVertices : vertices:LVertex<'Vertex,'Label> [] -> ArrayAdjacencyGraph<'Vertex,'Label,'Edge>
  member AddVertex : LVertex<'Vertex,'Label> -> ArrayAdjacencyGraph<'Vertex,'Label,'Edge>
  member private AdjacencyGraph : unit -> Dictionary<'Vertex,LEdge<'Vertex,'Edge> []>
  member ConnectedEdgesEmpty : v:'Vertex -> bool
  member ContainsEdge : edge:LEdge<'Vertex,'Edge> -> bool
  member ContainsVertex : vertex:'Vertex -> bool
  member Copy : unit -> ArrayAdjacencyGraph<'Vertex,'Label,'Edge>
  ...

--------------------
new : unit -> ArrayAdjacencyGraph<'Vertex,'Label,'Edge>
new : vertices:LVertex<'Vertex,'Label> list * edges:LEdge<'Vertex,'Edge> list -> ArrayAdjacencyGraph<'Vertex,'Label,'Edge>
Namespace ArrayAdjacencyGraph.Models
Namespace ArrayAdjacencyGraph.Models.Gilbert
Modul Gilbert

aus ArrayAdjacencyGraph.Models.Gilbert
val gilbertRandomGraph : ArrayAdjacencyGraph<int,string,float>
Multiple items
val int : value:'T -> int (requires member op_Explicit)

--------------------
[<Struct>]
type int = int32

--------------------
type int<'Measure> =
  int
Multiple items
val string : value:'T -> string

--------------------
type string = System.String
Multiple items
val float : value:'T -> float (requires member op_Explicit)

--------------------
[<Struct>]
type float = System.Double

--------------------
type float<'Measure> =
  float
val gilbert : numberOfVertices:int -> probability:float -> isDirected:bool -> fVertexKey:(int -> 'Vertex) -> fLabel:('Vertex -> 'Label) -> fWeight:('Vertex * 'Vertex -> 'Edge) -> ArrayAdjacencyGraph<'Vertex,'Label,'Edge> (requires equality and equality)
val id : x:'T -> 'T
val x : int
val sprintf : format:Printf.StringFormat<'T> -> 'T
val a : int
val b : int
Namespace ArrayAdjacencyGraph.Models.BarabasiAlbert
Modul BarabasiAlbert

aus ArrayAdjacencyGraph.Models.BarabasiAlbert
val barabasiAlbertGraph : ArrayAdjacencyGraph<int,string,float>
val barabasiAlbert : startingGraph:ArrayAdjacencyGraph<'Vertex,'Label,'Edge> -> numberOfVertices:int -> numberOfEdgesPerIteration:int -> fVertexKey:(int -> 'Vertex) -> fLabel:('Vertex -> 'Label) -> fWeight:('Vertex * 'Vertex -> 'Edge) -> ArrayAdjacencyGraph<'Vertex,'Label,'Edge> (requires equality and equality)
Namespace ArrayAdjacencyGraph.Models.Scale_free_graph
Modul BollobasRiordan

aus ArrayAdjacencyGraph.Models.Scale_free_graph
val bollobasRiordanGraph : ArrayAdjacencyGraph<int,int,float>
val bollobasRiordan : n:int -> alpha:float -> beta:float -> gamma:float -> delta_in:float -> delta_out:float -> create_using:ArrayAdjacencyGraph<int,int,float> -> ArrayAdjacencyGraph<int,int,float>