Social Network 1.0.0
The second major course output (MCO2) for CCDSALG.
Loading...
Searching...
No Matches
traversal.h
Go to the documentation of this file.
1/*
2 * Social Network uses graphs to represent relationships between users.
3 * Copyright (C) 2025 Raphael Panaligan Jek Degullado
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32#ifndef SOCIAL_NETWORK_TRAVERSAL_H_
33#define SOCIAL_NETWORK_TRAVERSAL_H_
34
35#include <stddef.h>
36
37#include "graph.h"
38
47void breadth_first_search(const Graph *const graph, const Vertex starting_vertex,
48 Vertex visited_vertices[MAX_GRAPH_VERTEX_COUNT], size_t *const visited_vertex_count);
49
58void depth_first_search(const Graph *const graph, const Vertex starting_vertex,
59 Vertex visited_vertices[MAX_GRAPH_VERTEX_COUNT], size_t *const visited_vertex_cnt);
60
61#endif // SOCIAL_NETWORK_TRAVERSAL_H_
62
63#ifdef __cplusplus
64}
65#endif
The helper functions that are used for handling and interacting with graphs and their vertices.
#define MAX_GRAPH_VERTEX_COUNT
The maximum number of vertices a graph can contain.
Definition graph.h:41
char Vertex[MAX_VERTEX_LABEL_LENGTH+1]
A string-labeled vertex in a graph.
Definition graph.h:44
A collection implementing the adjacency list data graph structure using arrays.
Definition graph.h:50
void depth_first_search(const Graph *const graph, const Vertex starting_vertex, Vertex visited_vertices[MAX_GRAPH_VERTEX_COUNT], size_t *const visited_vertex_cnt)
Traverses through all of a graph’s connected vertices starting from a specific vertex.
void breadth_first_search(const Graph *const graph, const Vertex starting_vertex, Vertex visited_vertices[MAX_GRAPH_VERTEX_COUNT], size_t *const visited_vertex_count)
Traverses through all of a graph’s connected vertices starting from a specific vertex.