31#ifndef SOCIAL_NETWORK_GRAPH_H_
32#define SOCIAL_NETWORK_GRAPH_H_
38#define MAX_VERTEX_LABEL_LENGTH 8
41#define MAX_GRAPH_VERTEX_COUNT 20
154 const Vertex destination_vertex);
void add_adjacency(Graph *const graph, const Vertex key_vertex, const Vertex adjacent_vertex)
Adds an adjacency between a pair of vertices to a graph.
void clone_graph(const Graph *const graph, Graph *const new_graph)
Clones the contents of a graph into another graph.
bool has_vertex(const Graph *const graph, const Vertex vertex)
Checks if a graph contains a vertex.
size_t get_adjacency_count(const Vertex adjacencies[MAX_GRAPH_VERTEX_COUNT])
Gets the total number of adjacencies in a key led array of adjacencies.
void initialize_graph(Graph *const graph, const size_t vertex_count)
Initializes a graph’s vertex adjacency arrays to their default values and sets its vertex count.
void sort_adjacencies(Graph *const graph)
Sorts the adjacency arrays by their keys alphabetically, and sorts their adjacent vertices alphabetic...
#define MAX_GRAPH_VERTEX_COUNT
The maximum number of vertices a graph can contain.
Definition graph.h:41
bool has_edge(const GraphEdge edges[], const size_t edge_count, const Vertex source_vertex, const Vertex destination_vertex)
Checks if a pair of vertices already has a corresponding edge in an array of edges.
#define MAX_VERTEX_LABEL_LENGTH
The maximum number of characters a vertex’ label can have.
Definition graph.h:38
size_t get_vertex_index(const Graph *const graph, const Vertex vertex)
Gets the index of the adjacency array of a vertex from a graph.
void get_edges(const Graph *const graph, GraphEdge edges[], size_t *const edge_count)
Gets the edges formed by connections between vertices contained in a graph.
bool has_adjacency(const Vertex adjacencies[MAX_GRAPH_VERTEX_COUNT], const Vertex adjacent_vertex)
Checks if a key led array of adjacencies contains an adjacent vertex.
char Vertex[MAX_VERTEX_LABEL_LENGTH+1]
A string-labeled vertex in a graph.
Definition graph.h:44
A(n) (un)directed connection between two vertices in a graph.
Definition graph.h:130
Vertex destination
The second or destination vertex of the connection.
Definition graph.h:134
Vertex source
The first or source vertex of the connection.
Definition graph.h:132
A collection implementing the adjacency list data graph structure using arrays.
Definition graph.h:50
Vertex adjacencies_by_vertex[MAX_GRAPH_VERTEX_COUNT][MAX_GRAPH_VERTEX_COUNT]
The vertices adjacent to the vertices contained by the graph.
Definition graph.h:58
size_t vertex_count
The number of vertices the graph contains.
Definition graph.h:52
size_t adjacencies_length
The number of vertex adjacency arrays the graph contains.
Definition graph.h:60