Social Network 1.0.0
The second major course output (MCO2) for CCDSALG.
Loading...
Searching...
No Matches
io.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_IO_H_
32#define SOCIAL_NETWORK_IO_H_
33
34#include <stdbool.h>
35
36#include "graph.h"
37
39#define BUFFER_SIZE 32
40
42#define WHITESPACE_DELIMITER " \f\n\r\t\v"
43
45#define NULL_VERTEX_LABEL "-1"
46
48typedef char StringBuffer[BUFFER_SIZE + 1];
49
56bool parse_graph_from_file(const StringBuffer input_file_name, Graph *const graph);
57
63void create_output_file_1(const Graph *const graph, const char graph_name);
64
70void create_output_file_2(const Graph *const graph, const char graph_name);
71
77void create_output_file_3(const Graph *const graph, const char graph_name);
78
84void create_output_file_4(const Graph *const graph, const char graph_name);
85
93void create_output_file_5(const Graph *const graph, const char graph_name, const Vertex starting_vertex);
94
102void create_output_file_6(const Graph *const graph, const char graph_name, const Vertex starting_vertex);
103
112void create_output_file_7(const Graph *const graph, const char graph_name, const Graph *const subgraph,
113 const char subgraph_name);
114
115#endif // SOCIAL_NETWORK_IO_H_
116
117#ifdef __cplusplus
118}
119#endif
The helper functions that are used for handling and interacting with graphs and their vertices.
char Vertex[MAX_VERTEX_LABEL_LENGTH+1]
A string-labeled vertex in a graph.
Definition graph.h:44
void create_output_file_4(const Graph *const graph, const char graph_name)
Creates the fourth output file, containing the adjacency matrix representation of a graph.
bool parse_graph_from_file(const StringBuffer input_file_name, Graph *const graph)
Parses a graph represented with an adjacency list from an input file.
void create_output_file_6(const Graph *const graph, const char graph_name, const Vertex starting_vertex)
Creates the sixth output file, containing the non-repeating traversal sequence of a graph using depth...
void create_output_file_5(const Graph *const graph, const char graph_name, const Vertex starting_vertex)
Creates the fifth output file, containing the non-repeating traversal sequence of a graph using bread...
void create_output_file_7(const Graph *const graph, const char graph_name, const Graph *const subgraph, const char subgraph_name)
Creates the seventh output file, containing the step-by-step check of whether a graph is a subgraph o...
#define BUFFER_SIZE
The size of buffers used in IO operations.
Definition io.h:39
void create_output_file_2(const Graph *const graph, const char graph_name)
Creates the second output file, containing the degrees of a graph’s vertices.
void create_output_file_3(const Graph *const graph, const char graph_name)
Creates the third output file, containing the adjacency list representation of a graph.
char StringBuffer[BUFFER_SIZE+1]
A string used to store text read from an input stream.
Definition io.h:48
void create_output_file_1(const Graph *const graph, const char graph_name)
Creates the first output file, containing a graph’s vertex labels and edges.
A collection implementing the adjacency list data graph structure using arrays.
Definition graph.h:50