addtition: dijkstra
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#ifndef GRAPH_H
|
||||
#define GRAPH_H
|
||||
|
||||
#include "arraylist.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Graph Graph;
|
||||
@@ -12,6 +13,7 @@ typedef enum {
|
||||
GRAPH_BAD_ALLOC,
|
||||
GRAPH_VERTEX_NOT_FOUND,
|
||||
GRAPH_NULL_ARG,
|
||||
GRAPH_EMPTY,
|
||||
} GraphErr ;
|
||||
|
||||
typedef enum {
|
||||
@@ -19,6 +21,11 @@ typedef enum {
|
||||
GRAPH_UNDIRECTED,
|
||||
} GraphType;
|
||||
|
||||
typedef struct {
|
||||
ArrayList *distances;
|
||||
ArrayList *prev;
|
||||
} DijkstraResult;
|
||||
|
||||
Graph *graph_create(GraphType type);
|
||||
GraphErr graph_destroy(Graph **graph);
|
||||
|
||||
@@ -32,5 +39,6 @@ GraphErr graph_connect_vertex(
|
||||
|
||||
GraphErr graph_vertex_count(Graph *graph, size_t *out);
|
||||
GraphErr graph_get_vertex(Graph *graph, size_t index, Vertex *out);
|
||||
GraphErr graph_dijkstra(Graph *graph, size_t source, DijkstraResult *result);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user