INGOR
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ytAdjGraph Class Reference

Graph by adjacent matrix. More...

Public Member Functions

ytAdjGraphytAdjGraph_new (int nodes)
 Generates the new ytAdjGraph instance.
 
void ytAdjGraph_delete (ytAdjGraph *this)
 Deletes the ytAdjGraph instance.
 
int ytAdjGraph_numNodes (const ytAdjGraph *this)
 Returnts the number of nodes.
 
int ytAdjGraph_numEdges (const ytAdjGraph *this)
 Returns the number of edges.
 
int ytAdjGraph_checkEdge (const ytAdjGraph *this, int src, int dst)
 Checks if the specified edge exists in the graph.
 
int ytAdjGraph_degree (const ytAdjGraph *this, int j)
 Returns the number of edges connected to the node.
 
int ytAdjGraph_numParents (const ytAdjGraph *this, int j)
 Returns the number of parents of the specified node.
 
void ytAdjGraph_addEdge (ytAdjGraph *this, int src, int dst)
 Adds an edge to the graph.
 
void ytAdjGraph_removeEdge (ytAdjGraph *this, int src, int dst)
 Removes the edge.
 
ytGraphEdgeIterytAdjGraph_edgeIter (const ytAdjGraph *this)
 Generates the ytGraphEdgeIter instance.
 
void ytAdjGraph_edgeIterNext (const ytAdjGraph *this, ytGraphEdgeIter *iter)
 

Detailed Description

Graph by adjacent matrix.

Member Function Documentation

◆ ytAdjGraph_addEdge()

void ytAdjGraph_addEdge ( ytAdjGraph 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.

◆ ytAdjGraph_checkEdge()

int ytAdjGraph_checkEdge ( const ytAdjGraph this,
int  src,
int  dst 
)

Checks if the specified edge exists in the graph.

Parameters
thispointer to the ytAdjGraph 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.

◆ ytAdjGraph_numParents()

int ytAdjGraph_numParents ( const ytAdjGraph this,
int  j 
)

Returns the number of parents of the specified node.

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

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

◆ ytAdjGraph_removeEdge()

void ytAdjGraph_removeEdge ( ytAdjGraph this,
int  src,
int  dst 
)

Removes the edge.

Parameters
this
src
dst

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