Skip to content

Instantly share code, notes, and snippets.

@manku-timma
Created July 22, 2014 08:08
Show Gist options
  • Save manku-timma/4c5560756aae379289b3 to your computer and use it in GitHub Desktop.
Save manku-timma/4c5560756aae379289b3 to your computer and use it in GitHub Desktop.
Graph api file - Toy programs for implementing graph algorithms
#ifndef __GRAPH_H_INCLUDED__
#define __GRAPH_H_INCLUDED__
#define MAX_VERTICES 10
struct graph {
int vertices[MAX_VERTICES];
int edges[MAX_VERTICES][MAX_VERTICES];
int visited[MAX_VERTICES];
};
void graph_init(struct graph* g);
void graph_print(struct graph* g);
void graph_print_bidi_dot(struct graph* g);
void graph_print_dot(struct graph* g);
void graph_add_edge(struct graph* g, int src, int dest, int weight);
void graph_add_bidi_edge(struct graph* g, int src, int dest, int weight);
void graph_dfs_recursive(struct graph* g, int start);
void graph_bfs(struct graph* g, int start);
void graph_bfs_print_path(int start, int end);
#endif // __GRAPH_H_INCLUDED__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment