INGOR
Public Member Functions | List of all members
ytNetwork Class Reference

Network abstraction. More...

#include <net/ytNetwork.h>

Public Member Functions

ytNetworkytNetwork_new ()
 Generates a ytNetwork instance.
 
void ytNetwork_delete (ytNetwork *this)
 Deletes the ytNetwork instance. More...
 
void ytNetwork_setGraph (ytNetwork *this, ytGraph *g)
 Sets the ytGraph instance as the structure.
 
ytGraphytNetwork_getGraph (const ytNetwork *this)
 Returns the ytGraph instance set as the structure.
 
void ytNetwork_addNode (ytNetwork *this, ytNode *node)
 Adds the ytNode instance. More...
 
ytNodeytNetwork_getNode (const ytNetwork *this, int j)
 Returns the ytNode instance at the specified index. More...
 
ytNodeytNetwork_setNode (ytNetwork *this, int j, ytNode *node)
 Replaces the ytNode instance. More...
 
int ytNetwork_numNodes (const ytNetwork *this)
 Returns the added ytNode instances.
 
int ytNetwork_numGraphNodes (const ytNetwork *this)
 Returns the number of nodes in the ytGraph instance set to this network.
 
int ytNetwork_degree (const ytNetwork *this, int j)
 Returns the degree of the specified node.
 
int ytNetwork_numParents (const ytNetwork *this, int j)
 Returns the number of parents.
 
int ytNetwork_maxParents (const ytNetwork *this)
 Returns the maximum number of parents. More...
 
int ytNetwork_numChildren (const ytNetwork *this, int j)
 Return the number of children.
 
int ytNetwork_numEdges (const ytNetwork *this)
 Returns the number of edges.
 
ytNodeytNetwork_getParent (const ytNetwork *this, int j, int k)
 Returns the parent of the specified node.
 
int ytNetwork_getParentId (const ytNetwork *this, int j, int k)
 Returns the index of the parent of the node.
 
void ytNetwork_setProperty (ytNetwork *this, const char *key, ytObject *value)
 Sets a property value with its key. More...
 
ytObjectytNetwork_getProperty (const ytNetwork *this, const char *key)
 Returns the property value associated with the specified key. More...
 
int ytNetwork_getPropertySize (const ytNetwork *this)
 
const char * ytNetwork_getPropertyKey (const ytNetwork *this, int i)
 
ytObjectytNetwork_getPropertyAt (const ytNetwork *this, int i)
 
int ytNetwork_findNode (const ytNetwork *this, const char *name)
 Returns the index of the node which has the specified name. More...
 
ytObjectytNetwork_getNodeProperty (ytNetwork *this, int j, const char *key)
 
void ytNetwork_setNodeProperty (ytNetwork *this, int j, const char *key, ytObject *value)
 
void ytNetwork_setEdge (ytNetwork *this, ytEdge *edge)
 Sets the ytEdge instance. More...
 
ytEdgeytNetwork_getEdge (ytNetwork *this, int u, int v)
 Returns the ytEdge instance. More...
 
ytEdgeytNetwork_getEdgeConst (const ytNetwork *this, int u, int v)
 Returns the ytEdge instance. More...
 
ytEdgeytNetwork_removeEdge (ytNetwork *this, int u, int v)
 Removes an edge. More...
 
size_t ytNetwork_size (const ytNetwork *this)
 
void ytNetwork_MPI_Bcast (ytNetwork **pNetwork, int root, MPI_Comm comm)
 [MPI] Broadcasts the ytNetwork instance with MPI. More...
 

Detailed Description

Network abstraction.

The structure of the network is maintained by the ytGraph instance. The any type of ytGraph implementations can be used.

Known properties

order
The topological order of the node indices. If the network is dag, the edges only from a node with the smaller order to one with larger the order exist. The i-th value represents the node index at the i-th order. See ytRNDGraph.
See also
ytNode, ytEdge, ytPCGraph

Member Function Documentation

◆ ytNetwork_addNode()

void ytNetwork_addNode ( ytNetwork this,
ytNode node 
)

Adds the ytNode instance.

Note that this does not add a node into the ytGraph instance set to this network.

◆ ytNetwork_delete()

void ytNetwork_delete ( ytNetwork this)

Deletes the ytNetwork instance.

Parameters
thispointer to the ytNetwork instance to delete.

◆ ytNetwork_findNode()

int ytNetwork_findNode ( const ytNetwork this,
const char *  name 
)

Returns the index of the node which has the specified name.

Parameters
thispointer to the ytNetwork instance.
namename of node to find.
Returns
index of node whose name is name, or -1 if not found.

◆ ytNetwork_getEdge()

ytEdge * ytNetwork_getEdge ( ytNetwork this,
int  u,
int  v 
)

Returns the ytEdge instance.

If the ytEdge instance is not set for the specified edge, new instance is genereted and returned.

◆ ytNetwork_getEdgeConst()

ytEdge * ytNetwork_getEdgeConst ( const ytNetwork this,
int  u,
int  v 
)

Returns the ytEdge instance.

Note that this may return a NULL pointer.

Returns
ytEdge instance or NULL if no edge properties are found for the edge.

◆ ytNetwork_getNode()

ytNode * ytNetwork_getNode ( const ytNetwork this,
int  j 
)

Returns the ytNode instance at the specified index.

Parameters
this
jindex of the node to return.

◆ ytNetwork_getProperty()

ytObject * ytNetwork_getProperty ( const ytNetwork this,
const char *  key 
)

Returns the property value associated with the specified key.

Parameters
thispointer to the ytNetwork instance.
keykey of the property to return.
Returns
property value associated with the key.

◆ ytNetwork_maxParents()

int ytNetwork_maxParents ( const ytNetwork this)

Returns the maximum number of parents.

Parameters
this

◆ ytNetwork_MPI_Bcast()

void ytNetwork_MPI_Bcast ( ytNetwork **  pNetwork,
int  root,
MPI_Comm  comm 
)

[MPI] Broadcasts the ytNetwork instance with MPI.

NOTE: Only the MPI-enabled library supports this routine.

Parameters
[in,out]networkpointer of pointer to the ytNetwork instance. For the root rank, it specifies the instance to send. Otherwise, it specifies the pointer to receive it. If the pointer is non-NULL in non-root rank processes, the instance will be deleted before receiving the broadcasted instance.
rootroot rank in the communicator to broadcast. Other ranks receive the broadcasted instance.
commMPI communicator.

◆ ytNetwork_removeEdge()

ytEdge * ytNetwork_removeEdge ( ytNetwork this,
int  u,
int  v 
)

Removes an edge.

This also removes edge in the ytGraph instance set in this ytNetwork instance.

Returns
Removed ytEdge instance, or NULL if not found.

◆ ytNetwork_setEdge()

void ytNetwork_setEdge ( ytNetwork this,
ytEdge edge 
)

Sets the ytEdge instance.

Note: if the ytEdge instance is already set for this edge, this overwrites the existing one and it will not be freed.

If the edge does not exists in the graph, it automatically adds it. The graph instance needs to be set in the network.

◆ ytNetwork_setNode()

ytNode * ytNetwork_setNode ( ytNetwork this,
int  j,
ytNode node 
)

Replaces the ytNode instance.

Returns
Old ytNode instance to be replaced.

◆ ytNetwork_setProperty()

void ytNetwork_setProperty ( ytNetwork this,
const char *  key,
ytObject value 
)

Sets a property value with its key.

Parameters
this
key
value

The documentation for this class was generated from the following file: