28static inline const char* graph_edge_type_name(
EdgeType edge_type) {
30 case TREE:
return "TREE";
31 case CROSS:
return "CROSS";
33 case BACK:
return "BACK";
struct Graph Graph
Definition graph.h:19
edgeType
Definition graph.h:21
@ TREE
Definition graph.h:22
@ FORWARD
Definition graph.h:24
@ BACK
Definition graph.h:25
@ CROSS
Definition graph.h:23
bool graph_is_weighted(Graph *g)
Check if graph is weighted.
int * graph_strong_components(Graph *g)
Create a array of strong components using tarjan algorithm.
Graph * graph_undirected_create()
Creates a new undirected graph.
Graph * graph_tarjan(Graph *g)
Create a new graph with tarjan arc classification as weight of the edges.
int graph_get_edge_weight(Graph *g, int u, int v)
Gets the weight of an edge.
Set * graph_get_neighbors(Graph *g, int node)
Gets the neighbors of a node.
bool graph_is_directed(Graph *g)
Check if graph is weighted.
void graph_remove_edge(Graph *g, int u, int v)
Removes an edge from the graph.
Graph * graph_create()
Creates a new directed graph.
Graph * graph_kruskal(Graph *g)
Run Kruskal algorithm to get the minimum-span tree.
Graph * graph_dijkstra(Graph *g, int source)
Run dijkstra algorithm on the graph.
int graph_max_node_id(Graph *g)
Get the maximum node id on the graph.
Iterator * graph_dfs(Graph *g, int start_node)
Performs a Depth-First Search on a graph.
void graph_add_node(Graph *g, int node)
Adds a node to the graph.
Iterator * graph_bfs(Graph *g, int start_node)
Performs a Breadth-First Search on a graph.
Graph * graph_prim(Graph *g, int start)
Run Prim algorithm to get the minimum-span tree.
void graph_export_to_dot(Graph *g, const char *filename)
Exports the graph to a DOT file for visualization with Graphviz.
Graph * graph_tarjan_create(bool directed)
Creates a new tarjan graph.
List * graph_topological_sort(Graph *g)
Creat a list with the nodes in topological sort.
void graph_add_edge(Graph *g, int u, int v)
Adds an edge to the graph.
void graph_print(Graph *g)
Prints the graph.
bool graph_is_dag(Graph *g)
Check if graph can be classified as Directed Acyclical Graph.
bool graph_has_edge(Graph *g, int u, int v)
Checks if an edge exists in the graph.
bool graph_acyclical(Graph *g)
Check if graph has cycles.
void graph_free(Graph *g)
Frees the memory allocated for the graph.
void graph_remove_node(Graph *g, int node)
Removes a node from the graph.
bool graph_has_node(Graph *g, int u)
Checks if a node exists in the graph.
List * graph_edges_ordered(Graph *g)
List with edges of the graph with (key,data) ordered ascending.
int graph_edges_sum(Graph *g)
Sum of the edge weights. If undirected, calculate (u, v) == (v, u) only once.
List * graph_shortest_path(Graph *g, int source, int destination)
Run dijkstra algorithm and return the shortest path.
void graph_add_edge_with_weight(Graph *g, int u, int v, int weight)
Adds a weighted edge to the graph.
int graph_minimum_distance(Graph *g, int source, int destination)
Run dijkstra algorithm and calculate the minimum distance.
Iterator * graph_nodes_iterator(Graph *g)
Iterate over nodes of the graph.
List * graph_edges(Graph *g)
List with edges of the graph with (key,data).
size_t graph_size(Graph *g)
Get the number of nodes.
struct ListNode List
A singly linked list.
Definition list.h:36
struct Set Set
A basic implementation of a Set.
Definition set.h:27
A generic iterator struct.
Definition iterator.h:13