Intoduction to Measures using FGraph

Graphoscope provides a comprehensive set of measurement tools designed to analyze, quantify, and interpret the features of graphs. These measurements offer valuable insights into the topology, connectivity, and dynamics of your networks. Whether you are exploring social connections, optimizing communication pathways, or studying the spread of diseases, our graph measurement functionalities are here to simplify your analysis and decision-making processes.

Creating a graph by reading a complete graph representation as one.

Step 1 is the loading of our example graph, sourced from The KONECT Project describing the grooming interactions between rhesus monkeys.

NetworkDensity

Network density measures the proportion of connections or edges present in a network relative to the total possible number of connections. It quantifies the level of interconnectedness between nodes in the network and carries several key implications for the Connectivity of the graph.

let networkDensity = Measures.GraphDensity.compute monkeyGraphDens
"The network density of the monkey graph is 0.462500"
namespace Graphoscope
namespace FSharpAux
namespace FSharpAux.IO
module SchemaReader from FSharpAux.IO
module Attribute from FSharpAux.IO.SchemaReader
<summary> Attributes to be added to fields of a schema record </summary>
Multiple items
namespace FSharp

--------------------
namespace Microsoft.FSharp
Multiple items
namespace FSharp.Data

--------------------
namespace Microsoft.FSharp.Data
val file: string
val monkeyGraphDens: FGraph<int,int,float>
type CsvFile = inherit CsvFile<CsvRow> member GetColumnIndex: columnName: string -> int member TryGetColumnIndex: columnName: string -> int option static member AsyncLoad: uri: string * ?separators: string * ?quote: char * ?hasHeaders: bool * ?ignoreErrors: bool * ?skipRows: int * ?encoding: Encoding -> Async<CsvFile> static member Load: stream: Stream * ?separators: string * ?quote: char * ?hasHeaders: bool * ?ignoreErrors: bool * ?skipRows: int -> CsvFile + 2 overloads static member Parse: text: string * ?separators: string * ?quote: char * ?hasHeaders: bool * ?ignoreErrors: bool * ?skipRows: int -> CsvFile
<summary> Represents a CSV file. The lines are read on demand from <c>reader</c>. Columns are delimited by one of the chars passed by <c>separators</c> (defaults to just <c>,</c>), and to escape the separator chars, the <c>quote</c> character will be used (defaults to <c>"</c>). If <c>hasHeaders</c> is true (the default), the first line read by <c>reader</c> will not be considered part of data. If <c>ignoreErrors</c> is true (the default is false), rows with a different number of columns from the header row (or the first row if headers are not present) will be ignored. The first <c>skipRows</c> lines will be skipped. </summary>
static member CsvFile.Load: reader: System.IO.TextReader * ?separators: string * ?quote: char * ?hasHeaders: bool * ?ignoreErrors: bool * ?skipRows: int -> CsvFile
static member CsvFile.Load: stream: System.IO.Stream * ?separators: string * ?quote: char * ?hasHeaders: bool * ?ignoreErrors: bool * ?skipRows: int -> CsvFile
static member CsvFile.Load: uri: string * ?separators: string * ?quote: char * ?hasHeaders: bool * ?ignoreErrors: bool * ?skipRows: int * ?encoding: System.Text.Encoding -> CsvFile
Multiple items
module Seq from Microsoft.FSharp.Collections
<summary>Contains operations for working with values of type <see cref="T:Microsoft.FSharp.Collections.seq`1" />.</summary>

--------------------
type Seq = static member CSV: separator: string -> header: bool -> flatten: bool -> data: seq<'a> -> seq<string> static member CSVwith: valFunc: ('a -> ('a -> obj)[]) -> strFunc: (string -> bool -> obj -> obj -> string) -> separator: string -> header: bool -> flatten: bool -> data: seq<'a> -> seq<string> static member fromFile: filePath: string -> seq<string> static member fromFileWithCsvSchema: filePath: string * separator: char * firstLineHasHeader: bool * ?skipLines: int * ?skipLinesBeforeHeader: int * ?schemaMode: SchemaModes -> seq<'schema> static member fromFileWithSep: separator: char -> filePath: string -> seq<string[]> static member stringFunction: separator: string -> flatten: bool -> input: 'a -> (obj -> string) static member valueFunction: dataEntry: 'a -> ('a -> obj)[] static member write: path: string -> data: seq<'a> -> unit static member writeOrAppend: path: string -> data: seq<'a> -> unit
val map: mapping: ('T -> 'U) -> source: seq<'T> -> seq<'U>
<summary>Builds a new collection whose elements are the results of applying the given function to each of the elements of the collection. The given function will be applied as elements are demanded using the <c>MoveNext</c> method on enumerators retrieved from the object.</summary>
<remarks>The returned sequence may be passed between threads safely. However, individual IEnumerator values generated from the returned sequence should not be accessed concurrently.</remarks>
<param name="mapping">A function to transform items from the input sequence.</param>
<param name="source">The input sequence.</param>
<returns>The result sequence.</returns>
<exception cref="T:System.ArgumentNullException">Thrown when the input sequence is null.</exception>
<example id="item-1"><code lang="fsharp"> let inputs = ["a"; "bbb"; "cc"] inputs |&gt; Seq.map (fun x -&gt; x.Length) </code> Evaluates to a sequence yielding the same results as <c>seq { 1; 3; 2 }</c></example>
val row: CsvRow
Multiple items
val int: value: 'T -> int (requires member op_Explicit)
<summary>Converts the argument to signed 32-bit integer. This is a direct conversion for all primitive numeric types. For strings, the input is converted using <c>Int32.Parse()</c> with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.</summary>
<param name="value">The input value.</param>
<returns>The converted int</returns>
<example id="int-example"><code lang="fsharp"></code></example>


--------------------
[<Struct>] type int = int32
<summary>An abbreviation for the CLI type <see cref="T:System.Int32" />.</summary>
<category>Basic Types</category>


--------------------
type int<'Measure> = int
<summary>The type of 32-bit signed integer numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to <see cref="T:System.Int32" />.</summary>
<category>Basic Types with Units of Measure</category>
Multiple items
val float: value: 'T -> float (requires member op_Explicit)
<summary>Converts the argument to 64-bit float. This is a direct conversion for all primitive numeric types. For strings, the input is converted using <c>Double.Parse()</c> with InvariantCulture settings. Otherwise the operation requires an appropriate static conversion method on the input type.</summary>
<param name="value">The input value.</param>
<returns>The converted float</returns>
<example id="float-example"><code lang="fsharp"></code></example>


--------------------
[<Struct>] type float = System.Double
<summary>An abbreviation for the CLI type <see cref="T:System.Double" />.</summary>
<category>Basic Types</category>


--------------------
type float<'Measure> = float
<summary>The type of double-precision floating point numbers, annotated with a unit of measure. The unit of measure is erased in compiled code and when values of this type are analyzed using reflection. The type is representationally equivalent to <see cref="T:System.Double" />.</summary>
<category index="6">Basic Types with Units of Measure</category>
Multiple items
module FGraph from Graphoscope

--------------------
type FGraph = new: unit -> FGraph static member addEdge: nk1: 'NodeKey -> nk2: 'NodeKey -> ed: 'EdgeData -> g: FGraph<'NodeKey,'NodeData,'EdgeData> -> FGraph<'NodeKey,'NodeData,'EdgeData> (requires comparison) static member addEdges: edgeSeq: seq<'NodeKey * 'NodeKey * 'EdgeData> -> g: FGraph<'NodeKey,'NodeData,'EdgeData> -> FGraph<'NodeKey,'NodeData,'EdgeData> (requires comparison) static member addElement: nk1: 'NodeKey -> nd1: 'NodeData -> nk2: 'NodeKey -> nd2: 'NodeData -> ed: 'EdgeData -> g: FGraph<'NodeKey,'NodeData,'EdgeData> -> FGraph<'NodeKey,'NodeData,'EdgeData> (requires comparison) static member addNode: nk: 'NodeKey -> nd: 'NodeData -> g: FGraph<'NodeKey,'NodeData,'EdgeData> -> FGraph<'NodeKey,'NodeData,'EdgeData> (requires comparison) static member addNodes: nodeSeq: seq<'NodeKey * 'NodeData> -> g: FGraph<'NodeKey,'NodeData,'EdgeData> -> FGraph<'NodeKey,'NodeData,'EdgeData> (requires comparison) static member clone: graph: FGraph<'NodeKey,'NodeData,'EdgeData> -> FGraph<'NodeKey,'NodeData,'EdgeData> (requires comparison) static member containsEdge: v1: 'NodeKey -> v2: 'NodeKey -> g: FGraph<'NodeKey,'NodeData,'EdgeData> -> bool (requires comparison) static member containsNode: vk: 'NodeKey -> g: FGraph<'NodeKey,'NodeData,'EdgeData> -> bool (requires comparison) static member countEdges: g: FGraph<'NodeKey,'NodeData,'EdgeData> -> int (requires comparison) ...

--------------------
type FGraph<'NodeKey,'NodeData,'EdgeData (requires comparison)> = System.Collections.Generic.Dictionary<'NodeKey,FContext<'NodeKey,'NodeData,'EdgeData>>

--------------------
new: unit -> FGraph
static member FGraph.ofSeq: edgelist: seq<'NodeKey * 'NodeData * 'NodeKey * 'NodeData * 'EdgeData> -> FGraph<'NodeKey,'NodeData,'EdgeData> (requires comparison)
val networkDensity: float
namespace Graphoscope.Measures
Multiple items
type GraphDensity = new: unit -> GraphDensity static member compute: graph: FGraph<'NodeKey,'NodeData,float> -> float (requires comparison) + 2 overloads static member ofAdjGraph: graph: AdjGraph<'NodeKey,'NodeData,float> -> float (requires comparison) static member ofDiGraph: graph: DiGraph<'NodeKey,'NodeData,'EdgeData> -> 'a3 (requires comparison) static member ofFGraph: graph: FGraph<'NodeKey,'NodeData,float> -> float (requires comparison)
<summary> Computes the graph density </summary>

--------------------
new: unit -> Measures.GraphDensity
static member Measures.GraphDensity.compute: graph: DiGraph<'NodeKey,'NodeData,'EdgeData> -> 'a3 (requires comparison)
static member Measures.GraphDensity.compute: graph: AdjGraph<'NodeKey,'NodeData,float> -> float (requires comparison)
static member Measures.GraphDensity.compute: graph: FGraph<'NodeKey,'NodeData,float> -> float (requires comparison)
val density: string
val sprintf: format: Printf.StringFormat<'T> -> 'T
<summary>Print to a string using the given format.</summary>
<param name="format">The formatter.</param>
<returns>The formatted result.</returns>
<example>See <c>Printf.sprintf</c> (link: <see cref="M:Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThen``1" />) for examples.</example>