INGOR
Public Member Functions | List of all members
ytPCGraph Struct Reference

Public Member Functions

int ytAdjGraph_numChildren (const ytAdjGraph *this, int j)
 Returns the number of children of the specified node. More...
 
const int * ytAdjGraph_getParents (const ytAdjGraph *this, int j)
 Returns the pointer to the parents. More...
 
const int * ytDBNGraph_getParents (const ytDBNGraph *this, int j)
 Returns the pointer to the parents. More...
 
ytPCGraphytPCGraph_new (int nodes)
 Generates the new ytPCGraph instance. More...
 
ytObjectytPCGraph_obj (ytPCGraph *this)
 Returns the pointer to the ytObject of this instance.
 
ytPCGraphytPCGraph_clone (const ytPCGraph *this)
 Returns a clone (deep copy) of this instance.
 
void ytPCGraph_delete (ytPCGraph *this)
 Deletes the ytPCGraph instance. More...
 
ytGraphytPCGraph_Graph (ytPCGraph *this)
 
ytPCGraphytPCGraph_from_Graph (ytGraph *this)
 Returns the pointer to the ytPCGraph from ytGraph.
 
void ytPCGraph_clear (ytPCGraph *this)
 Removes all the edges. More...
 
int ytPCGraph_numNodes (const ytPCGraph *this)
 Returns the number of nodes in the graph. More...
 
int ytPCGraph_checkEdge (const ytPCGraph *this, int src, int dst)
 Checks if the specified edge exists in the graph. More...
 
int ytPCGraph_numParents (const ytPCGraph *this, int j)
 Returns the number of parents of the specified node. More...
 
int ytPCGraph_numChildren (const ytPCGraph *this, int j)
 Returns the number of children of the specified node. More...
 
int ytPCGraph_numEdges (const ytPCGraph *this)
 Returns the number of edges in the graph. More...
 
int ytPCGraph_degree (const ytPCGraph *this, int j)
 Returns the number of edges connected to the node. More...
 
int ytPCGraph_getParent (const ytPCGraph *this, int j, int k)
 Returns the parent index of the node. More...
 
int ytPCGraph_getChild (const ytPCGraph *this, int j, int k)
 Returns the child index of the node. More...
 
const int * ytPCGraph_getParents (const ytPCGraph *this, int j)
 Returns the pointer to the parents. More...
 
const int * ytPCGraph_getChildren (const ytPCGraph *this, int j)
 Returns the pointer to the children. More...
 
void ytPCGraph_addEdge (ytPCGraph *this, int src, int dst)
 Adds an edge to the graph. More...
 
void ytPCGraph_removeEdge (ytPCGraph *this, int src, int dst)
 Removes the edge. More...
 
int ytPCGraph_removeLastEdge (ytPCGraph *this, int src, int dst)
 Removes the last edge. More...
 
void ytPCGraph_copy (ytPCGraph *this, const ytPCGraph *src)
 Copies edges to this graph. More...
 
void ytPCGraph_copyGraph (ytPCGraph *this, const ytGraph *src)
 Copies edges to this graph. More...
 
void ytPCGraph_addGraph (ytPCGraph *this, const ytGraph *src)
 Adds edges in the given graph into this graph. More...
 

Member Function Documentation

◆ ytAdjGraph_getParents()

const int * ytAdjGraph_getParents ( const ytAdjGraph this,
int  j 
)

Returns the pointer to the parents.

Parameters
this
j
Returns
pointer to the parents.

◆ ytAdjGraph_numChildren()

int ytAdjGraph_numChildren ( const ytAdjGraph this,
int  j 
)

Returns the number of children of the specified node.

Note: This requires O(n) time where n is the number of nodes.

Parameters
thispointer to the ytAdjGraph instance.
jnode index.
Returns
the number of children of the j -th node.

◆ ytDBNGraph_getParents()

const int * ytDBNGraph_getParents ( const ytDBNGraph this,
int  j 
)

Returns the pointer to the parents.

The returned pointer may be invalid after calling functions that affects the structure of the graph.

Parameters
this
j
Returns
pointer to the parents.

◆ ytPCGraph_addEdge()

void ytPCGraph_addEdge ( ytPCGraph this,
int  src,
int  dst 
)

Adds an edge to the graph.

This does not check whether the src - dst edge exists already in the graph.

Parameters
this
srcindex of the source node.
dstindex of the destination node.

◆ ytPCGraph_addGraph()

void ytPCGraph_addGraph ( ytPCGraph this,
const ytGraph src 
)

Adds edges in the given graph into this graph.

This checks if the edge in the source graph already exists in this graph.

Parameters
thispointer to the ytPCGraph instance.
srcsource graph.

◆ ytPCGraph_checkEdge()

int ytPCGraph_checkEdge ( const ytPCGraph this,
int  src,
int  dst 
)

Checks if the specified edge exists in the graph.

Parameters
thispointer to the ytPCGraph instance. NULL acceptable. If so, this always returns 0.
srcindex of starting node of the edge.
dstindex of ending node of the edge.
Returns
1 if the edge exists, or 0 otherwise.

◆ ytPCGraph_clear()

void ytPCGraph_clear ( ytPCGraph this)

Removes all the edges.

Parameters
thispointer to the ytPCGraph instance.

◆ ytPCGraph_copy()

void ytPCGraph_copy ( ytPCGraph this,
const ytPCGraph src 
)

Copies edges to this graph.

The current edges in this graph are removed, then edges in src are copied into this graph.

Parameters
this
src
See also
ytPCGraph_copyGraph()

◆ ytPCGraph_copyGraph()

void ytPCGraph_copyGraph ( ytPCGraph this,
const ytGraph src 
)

Copies edges to this graph.

The current edges in this graph are removed, then edges in src are copied into this graph.

Parameters
this
src
See also
ytPCGraph_copy()

◆ ytPCGraph_degree()

int ytPCGraph_degree ( const ytPCGraph this,
int  j 
)

Returns the number of edges connected to the node.

Parameters
this
j

◆ ytPCGraph_delete()

void ytPCGraph_delete ( ytPCGraph this)

Deletes the ytPCGraph instance.

Parameters
thispointer to the ytPCGraph instance to delete.
See also
ytPCGraph_new()

◆ ytPCGraph_getChild()

int ytPCGraph_getChild ( const ytPCGraph this,
int  j,
int  k 
)

Returns the child index of the node.

Parameters
thispointer to the ytPCGraph instance.
jnode index.
kchild index.
Returns
index of the k -th child of the j -th node.

◆ ytPCGraph_getChildren()

const int * ytPCGraph_getChildren ( const ytPCGraph this,
int  j 
)

Returns the pointer to the children.

Parameters
this
j

◆ ytPCGraph_getParent()

int ytPCGraph_getParent ( const ytPCGraph this,
int  j,
int  k 
)

Returns the parent index of the node.

Parameters
thispointer to the ytPCGraph instance.
jnode index.
kparent index.
Returns
index of the k -th parent of the j -th node.

◆ ytPCGraph_getParents()

const int * ytPCGraph_getParents ( const ytPCGraph this,
int  j 
)

Returns the pointer to the parents.

The returned pointer may be invalid after calling functions that affects the structure of the graph.

Parameters
this
j
Returns
pointer to the parents.

◆ ytPCGraph_Graph()

ytGraph * ytPCGraph_Graph ( ytPCGraph this)

\breif Returns this instance as a ytGraph instance.

Parameters
this
Returns
pointer to the ytGraph instance of this.

◆ ytPCGraph_new()

ytPCGraph * ytPCGraph_new ( int  nodes)

Generates the new ytPCGraph instance.

Use ytPCGraph_delete() to releases the resources allocated by this function.

Returns
pointer to the newly generated ytPCGraph instance.
See also
ytPCGraph_delete()

◆ ytPCGraph_numChildren()

int ytPCGraph_numChildren ( const ytPCGraph this,
int  j 
)

Returns the number of children of the specified node.

Parameters
thispointer to the ytPCGraph instance.
jnode index.
Returns
the number of children of the j -th node.

◆ ytPCGraph_numEdges()

int ytPCGraph_numEdges ( const ytPCGraph this)

Returns the number of edges in the graph.

Parameters
thispointer to the ytPCGraph instance.

◆ ytPCGraph_numNodes()

int ytPCGraph_numNodes ( const ytPCGraph this)

Returns the number of nodes in the graph.

Parameters
thispointer to the ytPCGraph instance.

◆ ytPCGraph_numParents()

int ytPCGraph_numParents ( const ytPCGraph this,
int  j 
)

Returns the number of parents of the specified node.

Parameters
thispointer to the ytPCGraph instance.
jnode index.
Returns
the number of parents of the j -th node.

◆ ytPCGraph_removeEdge()

void ytPCGraph_removeEdge ( ytPCGraph this,
int  src,
int  dst 
)

Removes the edge.

Parameters
this
src
dst

◆ ytPCGraph_removeLastEdge()

int ytPCGraph_removeLastEdge ( ytPCGraph this,
int  src,
int  dst 
)

Removes the last edge.

If the (src, dst) edge is not the last edge added, this fails to remove it and returns 1. Otherwise, that is, on successful, returns 0.

Parameters
this
src
dst

The documentation for this struct was generated from the following files: