The helper functions that are used to parse graphs from input files and to create output files.
More...
#include <stdbool.h>
#include "graph.h"
Go to the source code of this file.
|
#define | BUFFER_SIZE 32 |
| The size of buffers used in IO operations.
|
#define | WHITESPACE_DELIMITER " \f\n\r\t\v" |
| The delimiter to use when tokenizing strings to exclude whitespace characters.
|
#define | NULL_VERTEX_LABEL "-1" |
| The vertex label used to represent NULL, or the end of the list.
|
|
typedef char | StringBuffer[BUFFER_SIZE+1] |
| A string used to store text read from an input stream.
|
|
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_1 (const Graph *const graph, const char graph_name) |
| Creates the first output file, containing a graph’s vertex labels and edges.
|
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.
|
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.
|
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 breadth-first search.
|
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-first search.
|
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 of another.
|
The helper functions that are used to parse graphs from input files and to create output files.
- Author
- Raphael Panaligan
-
Jek Degullado
- Copyright
- GNU AGPLv3
◆ create_output_file_1()
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.
- Parameters
-
[in] | graph | The graph to use. |
[in] | graph_name | The name of the graph to use. |
◆ create_output_file_2()
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.
- Parameters
-
[in] | graph | The graph to use. |
[in] | graph_name | The name of the graph to use. |
◆ create_output_file_3()
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.
- Parameters
-
[in] | graph | The graph to use. |
[in] | graph_name | The name of the graph to use. |
◆ create_output_file_4()
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.
- Parameters
-
[in] | graph | The graph to use. |
[in] | graph_name | The name of the graph to use. |
◆ create_output_file_5()
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 breadth-first search.
- Parameters
-
[in] | graph | The graph to use. |
[in] | graph_name | The name of the graph to use. |
[in] | starting_vertex | The vertex to start the traversal from. |
◆ create_output_file_6()
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-first search.
- Parameters
-
[in] | graph | The graph to use. |
[in] | graph_name | The name of the graph to use. |
[in] | starting_vertex | The vertex to start the traversal from. |
◆ create_output_file_7()
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 of another.
- Parameters
-
[in] | graph | The graph to use. |
[in] | graph_name | The name of the graph to use. |
[in] | subgraph | The subgraph to use. |
[in] | subgraph_name | The name of the subgraph to use. |
◆ parse_graph_from_file()
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.
- Parameters
-
[in] | input_file_name | The name of the input file, or the path to it. |
[out] | graph | The graph parsed from the input file. |
- Returns
- Whether the input file was opened and read by the program.