smntc
an in-memory multimodal graph database
Loading...
Searching...
No Matches
Data Structures | Functions
Graph.c File Reference
#include <stdlib.h>
#include "errors.h"
#include "Inventory.h"
#include <stdio.h>
+ Include dependency graph for Graph.c:

Go to the source code of this file.

Data Structures

struct  Graph
 

Functions

struct GraphGraph_construct (unsigned int length, int *error)
 It constructs a graph storage.
 
struct GraphGraph_destruct (struct Graph *this)
 It destructs a graph storage.
 
unsigned int Graph_addVertex (struct Graph *this, int *error)
 It adds a vertex into a graph storage.
 
int Graph_hasEdge (const struct Graph *this, unsigned int source, unsigned int target, int *error)
 It checks if a graph storage has a directed edge between two vertices.
 
void Graph_addEdge (struct Graph *this, unsigned int source, unsigned int target, int *error)
 It adds a directed edge from a source vertex to a target vertex.
 
unsigned int Graph_countSources (const struct Graph *this, unsigned int target, int *error)
 It counts all source vertices that have an edge leading to a particular target vertex.
 
unsigned int Graph_countTargets (const struct Graph *this, unsigned int source, int *error)
 It counts all target vertices that have an edge leading from a particular source vertex.
 
void Graph_readSources (const struct Graph *this, unsigned int target, unsigned int length, unsigned int *sources, int *error)
 It reads all source vertices that have an edge leading to a particular target vertex.
 
void Graph_readTargets (const struct Graph *this, unsigned int source, unsigned int length, unsigned int *targets, int *error)
 It reads all target vertices that have an edge leading from a particular source vertex.
 
unsigned int Graph_readLastSource (const struct Graph *this, unsigned int target, int *error)
 It reads the last source vertex of a target vertex, if it exists.
 
unsigned int Graph_readLastTarget (const struct Graph *this, unsigned int source, int *error)
 It reads the last target vertex of a source vertex, if it exists.
 
void Graph_addCluster (struct Graph *this, unsigned int length, unsigned int *vertices, int *error)
 
void Graph_readCluster (const struct Graph *this, unsigned int predecessor, unsigned int length, unsigned int *vertices, int *error)
 
unsigned int Graph_protrudeCluster (struct Graph *this, unsigned int predecessor, int *error)
 
unsigned int Graph_getLength (const struct Graph *this)
 
void Graph_import (struct Graph *this, unsigned int index, unsigned int one, unsigned int two, unsigned int three, unsigned int four, unsigned int five, unsigned int six, int *error)
 
void Graph_export (struct Graph *this, unsigned int index, unsigned int *one, unsigned int *two, unsigned int *three, unsigned int *four, unsigned int *five, unsigned int *six, int *error)
 

Function Documentation

◆ Graph_addCluster()

void Graph_addCluster ( struct Graph this,
unsigned int  length,
unsigned int *  vertices,
int *  error 
)
Parameters
thisa graph storage
errorerror tracking (0 means no error)

Definition at line 744 of file Graph.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Graph_addEdge()

void Graph_addEdge ( struct Graph this,
unsigned int  source,
unsigned int  target,
int *  error 
)

It adds a directed edge from a source vertex to a target vertex.

Parameters
thisa graph storage
sourcea source vertex
targeta target vertex
errorerror tracking (0 means no error)

Definition at line 298 of file Graph.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Graph_addVertex()

unsigned int Graph_addVertex ( struct Graph this,
int *  error 
)

It adds a vertex into a graph storage.

Parameters
thisa graph storage
errorerror tracking (0 means no error)

Definition at line 136 of file Graph.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Graph_construct()

struct Graph * Graph_construct ( unsigned int  length,
int *  error 
)

It constructs a graph storage.

Parameters
lengththe number of unsigned integers allocated in memory
errorerror tracking (0 means no error)

Definition at line 29 of file Graph.c.

+ Here is the call graph for this function:

◆ Graph_countSources()

unsigned int Graph_countSources ( const struct Graph this,
unsigned int  target,
int *  error 
)

It counts all source vertices that have an edge leading to a particular target vertex.

Parameters
thisa graph storage
targeta target vertex
errorerror tracking (0 means no error)

Definition at line 482 of file Graph.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Graph_countTargets()

unsigned int Graph_countTargets ( const struct Graph this,
unsigned int  source,
int *  error 
)

It counts all target vertices that have an edge leading from a particular source vertex.

Parameters
thisa graph storage
sourcea source vertex
errorerror tracking (0 means no error)

Definition at line 504 of file Graph.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Graph_destruct()

struct Graph * Graph_destruct ( struct Graph this)

It destructs a graph storage.

Parameters
thisa graph storage

Definition at line 121 of file Graph.c.

+ Here is the caller graph for this function:

◆ Graph_export()

void Graph_export ( struct Graph this,
unsigned int  index,
unsigned int *  one,
unsigned int *  two,
unsigned int *  three,
unsigned int *  four,
unsigned int *  five,
unsigned int *  six,
int *  error 
)
Parameters
thisa graph storage
errorerror tracking

Definition at line 937 of file Graph.c.

+ Here is the call graph for this function:

◆ Graph_getLength()

unsigned int Graph_getLength ( const struct Graph this)
Parameters
thisa graph storage

Definition at line 897 of file Graph.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Graph_hasEdge()

int Graph_hasEdge ( const struct Graph this,
unsigned int  source,
unsigned int  target,
int *  error 
)

It checks if a graph storage has a directed edge between two vertices.

Parameters
thisa graph storage
sourcea source vertex
targeta target vertex
errorerror tracking (0 means no error)

Definition at line 179 of file Graph.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Graph_import()

void Graph_import ( struct Graph this,
unsigned int  index,
unsigned int  one,
unsigned int  two,
unsigned int  three,
unsigned int  four,
unsigned int  five,
unsigned int  six,
int *  error 
)
Parameters
thisa graph storage
errorerror tracking

Definition at line 902 of file Graph.c.

+ Here is the call graph for this function:

◆ Graph_protrudeCluster()

unsigned int Graph_protrudeCluster ( struct Graph this,
unsigned int  predecessor,
int *  error 
)
Parameters
thisa graph storage
errorerror tracking (0 means no error)

Definition at line 824 of file Graph.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Graph_readCluster()

void Graph_readCluster ( const struct Graph this,
unsigned int  predecessor,
unsigned int  length,
unsigned int *  vertices,
int *  error 
)
Parameters
thisa graph storage
errorerror tracking (0 means no error)

Definition at line 776 of file Graph.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Graph_readLastSource()

unsigned int Graph_readLastSource ( const struct Graph this,
unsigned int  target,
int *  error 
)

It reads the last source vertex of a target vertex, if it exists.

In case the target vertex is connected to no source vertices, zero is returned.

Returns
the last source vertex
Parameters
thisa graph storage
targeta target vertex
errorerror tracking (0 means no error)

Definition at line 680 of file Graph.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Graph_readLastTarget()

unsigned int Graph_readLastTarget ( const struct Graph this,
unsigned int  source,
int *  error 
)

It reads the last target vertex of a source vertex, if it exists.

In case the source vertex is connected to no target vertices, zero is returned.

Returns
the last target vertex
Parameters
thisa graph storage
sourcea source vertex
errorerror tracking (0 means no error)

Definition at line 712 of file Graph.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Graph_readSources()

void Graph_readSources ( const struct Graph this,
unsigned int  target,
unsigned int  length,
unsigned int *  sources,
int *  error 
)

It reads all source vertices that have an edge leading to a particular target vertex.

Parameters
thisa graph storage
targeta target vertex
lengthbuffer length
sourcesa buffer to put source vertices into
errorerror tracking (0 means no error)

Definition at line 526 of file Graph.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Graph_readTargets()

void Graph_readTargets ( const struct Graph this,
unsigned int  source,
unsigned int  length,
unsigned int *  targets,
int *  error 
)

It reads all target vertices that have an edge leading from a particular source vertex.

Parameters
thisa graph storage
sourcea source vertex
lengthbuffer length
targetsa buffer to put target vertices into
errorerror tracking (0 means no error)

Definition at line 603 of file Graph.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: