LibCapy - graph

Graph class.

Macros:

Enumerations:

None.

Typedefs:

None.

Struct CapyGraphNode :

Struct CapyGraphNode's properties:

ID of the node

Page rank value (default: 0.0, updated by CapyGraph.pageRank)

User's data

Struct CapyGraphNode's methods:

Destructor

Struct CapyGraphLink :

Struct CapyGraphLink's properties:

Pointer to the two nodes of the link

Struct CapyGraphLink's methods:

None.

Struct CapyGraph :

Struct CapyGraph's properties:

List of nodes

List of links

Flag to memorise if the graph is directed (default: false)

Connectivity matrix (updated with updateConnectivityMat()) connectivityMat[i*nbNode+j] is true if there is a link from i to j

Link distance matrix (updated with updateLinkDistanceMat()) linkDistanceMat[i*nbNode+j] is the smallest number of steps (in term of links) from i to j, 0 means there is no path from i to j

Struct CapyGraph's methods:

Destructor

Add a node to the graph.

Input argument(s):

node: the node to add

Exception(s):

May return CapyExc_MallocFailed

Add a link to the graph.

Input argument(s):

link: the link to add

Exception(s):

May return CapyExc_MallocFailed

Link two nodes in the graph given their id.

Input argument(s):

idA: ID of the first node
idB: ID of the second node

Exception(s):

May return CapyExc_MallocFailed, CapyExc_InvalidNodeIdx

Update the connectivity matrix of the graph

Exception(s):

May return CapyExc_MallocFailed, CapyExc_InvalidNodeIdx

Get the index of a node in the list of nodes of a graph

Input argument(s):

node: the node

Output and side effect(s):

Return the index of the node, or raise CapyExc_InvalidNodeIdx if the nodes wasn't found

Update the link distance matrix of the graph based on the current connectivity matrix (update it with updateConnectivityMat if necessary before using this method)

Exception(s):

May return CapyExc_MallocFailed

Run the PageRank algorithm to evaluate nodes in the graph

Input argument(s):

nbIter: number of iteration of the algorithm

Output and side effect(s):

The pageRank properties of nodes is updated

Remove all links whose first node is equal to the given one

Input argument(s):

id: id of the first node of the links to be removed

Output and side effect(s):

All links whose first node is equal to the given one are removed

Get a node by its id

Input argument(s):

id: the node id

Output and side effect(s):

Return the node, or null if the given id couldn't be found

Find a link between two nodes

Input argument(s):

idA: the first node id
idB: the second node id

Output and side effect(s):

Return the link, or null if there is no link between the two nodes. The order of ids is irrelevant.

Functions:

Create a CapyGraphNode

Input argument(s):

id: id of the node in the graph

Output and side effect(s):

Return the node.

Create a CapyGraph

Output and side effect(s):

Return a CapyGraph

Allocate memory for a new CapyGraph and create it

Output and side effect(s):

Return a CapyGraph

Exception(s):

May raise CapyExc_MallocFailed.

Free the memory used by a CapyGraph* and reset '*that' to NULL

Input argument(s):

that: a pointer to the CapyGraph to free

2022-06-21
in LibCapy,
55 views
Copyright 2021-2024 Baillehache Pascal