UndirectedGraph Type

Constructors

Constructor Description

UndirectedGraph()

Full Usage: UndirectedGraph()

Returns: UndirectedGraph
Returns: UndirectedGraph

Static members

Static member Description

UndirectedGraph.addEdge edge graph

Full Usage: UndirectedGraph.addEdge edge graph

Parameters:
    edge : 'NodeKey * 'NodeKey * 'EdgeData - The edge to be created. A three part tuple containing the origin node, the destination node, and any edge label such as the weight.
    graph : UndirectedGraph<'NodeKey, 'a, 'EdgeData> - The graph the edge will be added to.

Returns: UndirectedGraph<'NodeKey, 'a, 'EdgeData> Unit

Adds a new edge to the graph

edge : 'NodeKey * 'NodeKey * 'EdgeData

The edge to be created. A three part tuple containing the origin node, the destination node, and any edge label such as the weight.

graph : UndirectedGraph<'NodeKey, 'a, 'EdgeData>

The graph the edge will be added to.

Returns: UndirectedGraph<'NodeKey, 'a, 'EdgeData>

Unit

UndirectedGraph.addEdges edges graph

Full Usage: UndirectedGraph.addEdges edges graph

Parameters:
    edges : ('NodeKey * 'NodeKey * 'EdgeData)[] - The array of edges. Each edge is a three part tuple containing the origin node, the destination node, and any edge label such as the weight.
    graph : UndirectedGraph<'NodeKey, 'c, 'EdgeData> - The graph to add the edge to

Returns: UndirectedGraph<'NodeKey, 'c, 'EdgeData> Unit

Adds many edges to a graph at once

edges : ('NodeKey * 'NodeKey * 'EdgeData)[]

The array of edges. Each edge is a three part tuple containing the origin node, the destination node, and any edge label such as the weight.

graph : UndirectedGraph<'NodeKey, 'c, 'EdgeData>

The graph to add the edge to

Returns: UndirectedGraph<'NodeKey, 'c, 'EdgeData>

Unit

UndirectedGraph.addElement nk1 nd1 nk2 nd2 ed g

Full Usage: UndirectedGraph.addElement nk1 nd1 nk2 nd2 ed g

Parameters:
    nk1 : 'NodeKey
    nd1 : 'NodeData
    nk2 : 'NodeKey
    nd2 : 'NodeData
    ed : 'EdgeData
    g : UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>

Returns: UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>
nk1 : 'NodeKey
nd1 : 'NodeData
nk2 : 'NodeKey
nd2 : 'NodeData
ed : 'EdgeData
g : UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>
Returns: UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>

UndirectedGraph.addNode nodeKey nodeData graph

Full Usage: UndirectedGraph.addNode nodeKey nodeData graph

Parameters:
    nodeKey : 'NodeKey
    nodeData : 'NodeData
    graph : UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData> - The graph the node will be added to.

Returns: UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData> Unit

Adds a new node to the graph

nodeKey : 'NodeKey
nodeData : 'NodeData
graph : UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>

The graph the node will be added to.

Returns: UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>

Unit

UndirectedGraph.addNodes nodes graph

Full Usage: UndirectedGraph.addNodes nodes graph

Parameters:
    nodes : ('NodeKey * 'NodeData)[]
    graph : UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>

Returns: UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>
nodes : ('NodeKey * 'NodeData)[]
graph : UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>
Returns: UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>

UndirectedGraph.countEdges graph

Full Usage: UndirectedGraph.countEdges graph

Parameters:
    graph : UndirectedGraph<'NodeKey, 'b, 'EdgeData> - The graph to be analysed

Returns: int A float of the total edges

Gets the total number of edges of the graph

graph : UndirectedGraph<'NodeKey, 'b, 'EdgeData>

The graph to be analysed

Returns: int

A float of the total edges

UndirectedGraph.countNodes graph

Full Usage: UndirectedGraph.countNodes graph

Parameters:
Returns: int A float of the total nodes

Gets the total number of nodes of the graph

graph : UndirectedGraph<'NodeKey, 'b, 'c>

The graph to be analysed

Returns: int

A float of the total nodes

UndirectedGraph.create (nodes, edges)

Full Usage: UndirectedGraph.create (nodes, edges)

Parameters:
    nodes : ('NodeKey * 'NodeData)[]
    edges : ('NodeKey * 'NodeKey * 'EdgeData)[]

Returns: UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>
nodes : ('NodeKey * 'NodeData)[]
edges : ('NodeKey * 'NodeKey * 'EdgeData)[]
Returns: UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>

UndirectedGraph.createFromEdges edges

Full Usage: UndirectedGraph.createFromEdges edges

Parameters:
    edges : ('NodeKey * 'NodeKey * 'EdgeData)[] - An array of edges. Each edge is a triple of origin node, the destination node, and any edge data such as the weight

Returns: UndirectedGraph<'NodeKey, 'NodeKey, 'EdgeData> A graph containing the nodes

Builds a graph from a list of edges. This is a shorthand graph generation method where NodeData is assumed to be the same as NodeKey.

edges : ('NodeKey * 'NodeKey * 'EdgeData)[]

An array of edges. Each edge is a triple of origin node, the destination node, and any edge data such as the weight

Returns: UndirectedGraph<'NodeKey, 'NodeKey, 'EdgeData>

A graph containing the nodes

UndirectedGraph.createFromNodes nodes

Full Usage: UndirectedGraph.createFromNodes nodes

Parameters:
    nodes : ('NodeKey * 'NodeData)[]

Returns: UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>
nodes : ('NodeKey * 'NodeData)[]
Returns: UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>

UndirectedGraph.find origin destination graph

Full Usage: UndirectedGraph.find origin destination graph

Parameters:
    origin : 'NodeKey - The starting node of the edge
    destination : 'NodeKey - The target node of the edge
    graph : UndirectedGraph<'NodeKey, 'a, 'EdgeData> - The graph to find the edge in

Returns: 'NodeKey * 'NodeKey * 'EdgeData A edge as a three part tuple of origin node, the destination node, and any edge label such as the weight.

Tries to find an edge between the specified nodes. Raises KeyNotFoundException if no such edge exists in the graph.

origin : 'NodeKey

The starting node of the edge

destination : 'NodeKey

The target node of the edge

graph : UndirectedGraph<'NodeKey, 'a, 'EdgeData>

The graph to find the edge in

Returns: 'NodeKey * 'NodeKey * 'EdgeData

A edge as a three part tuple of origin node, the destination node, and any edge label such as the weight.

UndirectedGraph.getAllEdges graph

Full Usage: UndirectedGraph.getAllEdges graph

Parameters:
    graph : UndirectedGraph<'NodeKey, 'a, 'EdgeData> - The graph the edges are present in

Returns: ('NodeKey * 'NodeKey * 'EdgeData)[] An array of origin, destination nodes and the corresponding 'EdgeData tuples.

Returns the all edges in the graph

graph : UndirectedGraph<'NodeKey, 'a, 'EdgeData>

The graph the edges are present in

Returns: ('NodeKey * 'NodeKey * 'EdgeData)[]

An array of origin, destination nodes and the corresponding 'EdgeData tuples.

UndirectedGraph.getEdges origin graph

Full Usage: UndirectedGraph.getEdges origin graph

Parameters:
    origin : 'NodeKey - The node from which the edges start
    graph : UndirectedGraph<'NodeKey, 'c, 'EdgeData> - The graph the node is present in

Returns: ('NodeKey * 'EdgeData)[] An array of target nodes and the corresponding 'EdgeData.

Returns the edges for given node

origin : 'NodeKey

The node from which the edges start

graph : UndirectedGraph<'NodeKey, 'c, 'EdgeData>

The graph the node is present in

Returns: ('NodeKey * 'EdgeData)[]

An array of target nodes and the corresponding 'EdgeData.

UndirectedGraph.getNodes graph

Full Usage: UndirectedGraph.getNodes graph

Parameters:
Returns: 'NodeKey[] An array of nodes

Returns all nodes in te graph

graph : UndirectedGraph<'NodeKey, 'c, 'd>

The graph to be analysed

Returns: 'NodeKey[]

An array of nodes

UndirectedGraph.normalizeEdges graph

Full Usage: UndirectedGraph.normalizeEdges graph

Parameters:
    graph : UndirectedGraph<'NodeKey, 'a, float> - The graph to perform the operation on

Returns: UndirectedGraph<'NodeKey, 'a, float> Unit

Normalises the weights of edges for each node in a graph. The function assumes that the edge data type of the graph will be float.

graph : UndirectedGraph<'NodeKey, 'a, float>

The graph to perform the operation on

Returns: UndirectedGraph<'NodeKey, 'a, float>

Unit

UndirectedGraph.ofSeq edgelist

Full Usage: UndirectedGraph.ofSeq edgelist

Parameters:
    edgelist : seq<'NodeKey * 'NodeData * 'NodeKey * 'NodeData * 'EdgeData>

Returns: UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>
edgelist : seq<'NodeKey * 'NodeData * 'NodeKey * 'NodeData * 'EdgeData>
Returns: UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>

UndirectedGraph.removeEdge edge graph

Full Usage: UndirectedGraph.removeEdge edge graph

Parameters:
    edge : 'NodeKey * 'NodeKey - The edge to be removed. A two part tuple containing the origin node, the destination node.
    graph : UndirectedGraph<'NodeKey, 'a, 'EdgeData> - The graph the edge will be removed from.

Returns: UndirectedGraph<'NodeKey, 'a, 'EdgeData> Unit

Removes an edge to the graph.

edge : 'NodeKey * 'NodeKey

The edge to be removed. A two part tuple containing the origin node, the destination node.

graph : UndirectedGraph<'NodeKey, 'a, 'EdgeData>

The graph the edge will be removed from.

Returns: UndirectedGraph<'NodeKey, 'a, 'EdgeData>

Unit

UndirectedGraph.removeNode node graph

Full Usage: UndirectedGraph.removeNode node graph

Parameters:
    node : 'NodeKey - The node to be removed.
    graph : UndirectedGraph<'NodeKey, 'a, 'EdgeData> - The graph the edge will be removed from.

Returns: UndirectedGraph<'NodeKey, 'a, 'EdgeData> Unit

Removes a node from the graph

node : 'NodeKey

The node to be removed.

graph : UndirectedGraph<'NodeKey, 'a, 'EdgeData>

The graph the edge will be removed from.

Returns: UndirectedGraph<'NodeKey, 'a, 'EdgeData>

Unit

UndirectedGraph.toAdjacencyMatrix getEdgeWeight graph

Full Usage: UndirectedGraph.toAdjacencyMatrix getEdgeWeight graph

Parameters:
    getEdgeWeight : 'EdgeData -> float
    graph : UndirectedGraph<'a, 'b, 'EdgeData> - The graph to be converted

Returns: float[][] An adjacency matrix

Converts the Graph to an Adjacency Matrix This is preliminary step in many graph algorithms such as Floyd-Warshall. The operation assumes edge data types of float in the graph.

getEdgeWeight : 'EdgeData -> float
graph : UndirectedGraph<'a, 'b, 'EdgeData>

The graph to be converted

Returns: float[][]

An adjacency matrix

UndirectedGraph.toSeq graph

Full Usage: UndirectedGraph.toSeq graph

Parameters:
Returns: seq<'NodeKey * 'NodeData * 'NodeKey * 'NodeData * 'EdgeData>
graph : UndirectedGraph<'NodeKey, 'NodeData, 'EdgeData>
Returns: seq<'NodeKey * 'NodeData * 'NodeKey * 'NodeData * 'EdgeData>