aboutsummaryrefslogtreecommitdiff
path: root/src/graph.h
diff options
context:
space:
mode:
authorMikkel Thestrup <mithe24@student.sdu.dk>2025-12-11 11:00:00 +0100
committerMikkel Thestrup <mithe24@student.sdu.dk>2025-12-11 11:00:00 +0100
commit8f512a36a5687b806e27775480878dded7a028ef (patch)
tree97c2624fcfefe8bc2f401b674ac31a347cfab0c8 /src/graph.h
parent2d4bdcdbfe9e3db3c0f204e843a271c929fec623 (diff)
downloadcycle-detector-8f512a36a5687b806e27775480878dded7a028ef.tar.gz
cycle-detector-8f512a36a5687b806e27775480878dded7a028ef.zip
I prefer inline typedef
Diffstat (limited to '')
-rw-r--r--src/graph.h28
1 files changed, 7 insertions, 21 deletions
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.