C Everything
This is a C repository containing a curated set of generic data structures and algorithm.
|
Contains definitions of routines supported by graph. More...
#include "graph.h"
#include "link_list.h"
#include "queue.h"
#include "stack.h"
#include "heap.h"
#include "disjoint_set.h"
#include "array.h"
Go to the source code of this file.
Functions | |
t_gen | graph_delete (t_gen, t_gen) |
t_gen | graph_find (t_gen d, t_gen data) |
Find a Vertex(node) in graph; More... | |
int | graph_len (t_gen g) |
get num Vertex(nodes) in graph; More... | |
t_gen | graph_add_vertex (t_gen d, t_gen data) |
Add a Vertex(node) in graph; More... | |
t_gen | graph_has_edge (t_gen d, t_gen n1, t_gen n2) |
Check edge between two Vertices(nodes) in graph; More... | |
t_gen | graph_add_edge (t_gen d, t_gen n1, t_gen n2) |
Add an asymmetric edge between two vertices(nodes) in graph; More... | |
t_gen | graph_del_edge (t_gen d, t_gen n1, t_gen n2) |
Del an asymmetric edge between two vertices(nodes) in graph; More... | |
t_gen | graph_add_edge_sym (t_gen d, t_gen n1, t_gen n2) |
Add a symmetric edge between two vertices(nodes) in graph; More... | |
t_gen | graph_del_edge_sym (t_gen d, t_gen n1, t_gen n2) |
Del a symmetric edge between two vertices(nodes) in graph; More... | |
t_gen | graph_del_vertex (t_gen d, t_gen n1) |
Del a vertex(node) in graph; More... | |
t_gen | graph_add_wedge (t_gen d, t_gen n1, t_gen n2, int weight) |
Add an asymmetric weighted edge between two vertices(nodes) in graph; More... | |
t_gen | graph_add_wedge_sym (t_gen d, t_gen n1, t_gen n2, int weight) |
Add a symmetric weighted edge between two vertices(nodes) in graph; More... | |
t_gen | graph_bfs (t_gen d, t_gen n) |
Breath First Search BFS info Contains More... | |
t_gen | graph_dfs (t_gen d, t_gen n) |
Depth First Search DFS info contains More... | |
t_gen | graph_toplogicaly_order_dag (t_gen d) |
Topologicaly order/Topologicaly sort the nodes of a DAG And get the longest path to each of the vertices in DAG The topologicaly order nodes instead of being printed can be pushed to link list and return. More... | |
void | graph_neigh_print (t_gen d, t_gen neigh) |
Util function to Print neighbor list of a vetex(node) More... | |
void | graph_print (t_gen d) |
Print Graph info More... | |
void | graph_wprint (t_gen d) |
Print Graph info with edge weights More... | |
void | graph_destroy (t_gen d) |
Destroy instance of graph More... | |
t_gen | create_graph (char *name, int size, t_dparams *prm) |
Create an instance of graph More... | |
e_cmpr | graph_neigh_list_compare (t_gen x, t_gen y) |
Util compare function for neigh link list node data More... | |
void | graph_neigh_list_free (t_gen mem, char *file, int line) |
Util free function for deleting neigh link list node data More... | |
void | bfs_core (t_graph *g, t_gnode *node, t_bfsinfo *bfs, t_queue *q, int comp) |
Breath First Search Core routine This routine does bfs on all conncted components More... | |
void | dfs_core (t_graph *g, t_gnode *node, t_dfsinfo *dfs, t_stack *s, int comp, int *gcount) |
Depth First Search Core routine This routine does dfs on all conncted components More... | |
t_gen | graph_dfs_optimised (t_gen d, t_gen n) |
Depth First Search Optimised by eliminating the need for revisiting a previously visited vetex in neighbor list. Note: These visits happen only during the scanning of neighbor list to get an unvisited node More... | |
void | graph_wneigh_print (t_gen d, t_gen neigh) |
Util function to Print neighbor list of a vetex(node) with edge weights More... | |
e_cmpr | graph_wedge_cmpr (t_gen x, t_gen y) |
Utils function used for comparing two different graph edges More... | |
e_cmpr | graph_wedge_cmpr_idx (t_gen x, int i, int j) |
Utils function used by genric heap for comparing graph edge weights More... | |
e_cmpr | graph_wedge_cmpr_idx2 (t_gen x, int i, int j) |
Utils function used by quick sort for comparing graph edge weights More... | |
t_gen | dijkstra (t_gen d, t_gen data) |
Utils function used by quick sort for swapping graph edges More... | |
t_gen | bellman_ford (t_gen d, t_gen data) |
Find the shortest path from a given source vertex to all source nodes in a graph with negative edges this is an improvent of bellman ford using Shortest Path Faster Algorithm (SPFA) More... | |
t_gen | prims_mst (t_gen d) |
Find the Minimum Spanning for weighted undirected graph Using Prim's Algorithm More... | |
t_gen | kruskals_mst (t_gen d) |
Find the Minimum Spanning for weighted undirected graph Using Kruskal's Algorithm More... | |
Contains definitions of routines supported by graph.
Definition in file graph.c.
Find the shortest path from a given source vertex to all source nodes in a graph with negative edges this is an improvent of bellman ford using Shortest Path Faster Algorithm (SPFA)
d | - Pointer instance of graph |
data | - Pointer to source vertex data |
Breath First Search Core routine This routine does bfs on all conncted components
g | - Pointer instance of graph |
d | - Pointer to Source node from where to start BFS |
bfs | - Pointer to bfs info of each vertex |
q | - Pointer to queue used for BFS |
comp | - Component of the graph |
Depth First Search Core routine This routine does dfs on all conncted components
g | - Pointer instance of graph |
d | - Pointer to Source node from where to start DFS |
dfs | - Pointer to dfs info of each vertex |
s | - Pointer to stack used for DFS |
comp | - Component of the graph |
gcount | - Pointer to count value that used to store pre/post(arrival/depature) of a vertex |
Utils function used by quick sort for swapping graph edges
d | - Pointer to array |
i | - index 1 |
j | - index 2 |
Find the shortest path from a given source vertex to all source nodes in a graph using Dijkstra's algo
d | - Pointer instance of graph |
data | - Pointer to source vertex data |
Breath First Search BFS info Contains
d | - Pointer instance of graph |
n | - Pointer to data1 (Source node from where to start BFS) |
void graph_destroy | ( | t_gen | d | ) |
Depth First Search DFS info contains
d | - Pointer instance of graph |
n | - Pointer to data1 (Source node from where to start DFS) |
Depth First Search Optimised by eliminating the need for revisiting a previously visited vetex in neighbor list. Note: These visits happen only during the scanning of neighbor list to get an unvisited node
d | - Pointer instance of graph |
n | - Pointer to data1 (Source node from where to start DFS) |
int graph_len | ( | t_gen | g | ) |
void graph_neigh_list_free | ( | t_gen | mem, |
char * | file, | ||
int | line | ||
) |
void graph_print | ( | t_gen | d | ) |
Topologicaly order/Topologicaly sort the nodes of a DAG And get the longest path to each of the vertices in DAG The topologicaly order nodes instead of being printed can be pushed to link list and return.
d | - Pointer instance of graph |
void graph_wprint | ( | t_gen | d | ) |
Find the Minimum Spanning for weighted undirected graph Using Kruskal's Algorithm
d | - Pointer instance of graph |
Find the Minimum Spanning for weighted undirected graph Using Prim's Algorithm
d | - Pointer instance of graph |