Social Network 1.0.0
The second major course output (MCO2) for CCDSALG.
Loading...
Searching...
No Matches
queue.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
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31#ifndef SOCIAL_NETWORK_QUEUE_H_
32#define SOCIAL_NETWORK_QUEUE_H_
33
34#include <stddef.h>
35
36#include "graph.h"
37
44typedef struct Queue {
48 size_t front;
50 size_t rear;
52
57void initialize_queue(Queue *const queue);
58
65void enqueue(Queue *const queue, const Vertex element);
66
72void dequeue(Queue *const queue);
73
80void peak(Queue *const queue, Vertex element);
81
87bool is_full(const Queue *const queue);
88
94bool is_empty(const Queue *const queue);
95
96#endif // SOCIAL_NETWORK_QUEUE_H_
97
98#ifdef __cplusplus
99}
100#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
void enqueue(Queue *const queue, const Vertex element)
Adds an element to the rear of the queue.
void dequeue(Queue *const queue)
Removes the element at the front of the queue.
bool is_empty(const Queue *const queue)
Checks if a queue contains contains no queueing elements.
void peak(Queue *const queue, Vertex element)
Gets the element at the front of the queue.
bool is_full(const Queue *const queue)
Checks if a queue contains the maximum number of elements.
void initialize_queue(Queue *const queue)
Initializes a queue’s data and indexes to their default values.
A collection implementing the queue data structure using an array.
Definition queue.h:44
size_t rear
The index of the last element in the queue.
Definition queue.h:50
Vertex data[MAX_GRAPH_VERTEX_COUNT]
The ordered data contained in the queue.
Definition queue.h:46
size_t front
The index of the first element in the queue.
Definition queue.h:48