From 8f512a36a5687b806e27775480878dded7a028ef Mon Sep 17 00:00:00 2001 From: Mikkel Thestrup Date: Thu, 11 Dec 2025 11:00:00 +0100 Subject: I prefer inline typedef --- src/graph.h | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) (limited to 'src/graph.h') diff --git a/src/graph.h b/src/graph.h index 00d4d6c..e5417b9 100644 --- a/src/graph.h +++ b/src/graph.h @@ -16,21 +16,7 @@ * @details Each vertex is identified by a unique ID and maintains lists of * vertices it points to and vertices that point to it. */ -typedef struct Vertex Vertex; - -/** - * @struct Graph - * @brief A directed graph container. - * @details Maintains an array of all vertices and tracks the total number - * of vertices and edges in the graph. - */ -typedef struct Graph Graph; - -/** - * @struct Vertex - * @brief Represents a single vertex in a directed graph. - */ -struct Vertex { +typedef struct Vertex { /** * @brief Unique identifier for this vertex. * @details A value in the range [0, num_vertices) where num_vertices @@ -53,15 +39,15 @@ struct Vertex { * list is of type (Vertex*). */ Vector *in_neighbours; -}; +} Vertex; /** * @struct Graph - * @brief A directed graph container structure. - * @details The graph is represented using an adjacency list model where - * both incoming and outgoing edges are tracked for each vertex. + * @brief A directed graph container. + * @details Maintains an array of all vertices and tracks the total number + * of vertices and edges in the graph. */ -struct Graph { +typedef struct Graph { /** * @brief The total number of vertices in the graph. * @details Vertices are indexed from 0 to (num_vertices - 1). @@ -81,7 +67,7 @@ struct Graph { * Index i contains the vertex with id = i. */ Vertex *vertices; -}; +} Graph; /** * @brief Allocates and constructs a new graph with n vertices. -- cgit v1.2.3-70-g09d2