1 #ifndef _GRAPH_H_
 2 #define _GRAPH_H_
 3 #include <stdbool.h>
 4 
 5 typedef struct graph Graph;
 6 typedef struct headNode HeadNode;
 7 typedef struct peerNode PeerNode;
 8 
 9 struct graph{
10     int * vertex;    //vertex array
11     int vertexSize;    //graph's vertex size
12     HeadNode * head;    //vertex's head node;
13 };
14 
15 struct headNode{
16     int vertex;            //current vertex 
17     int adjSize;        //current vertex's adjacency size
18     PeerNode * firstPeer;   //current vertex's first peer node 
19 };
20 
21 struct peerNode{
22     int peer;            //vertex's peer
23     int weight;            //edge weight
24     PeerNode * next;        //next peer node
25 };
26 
27 void create_graph(Graph * g, int vertexSize);
28 
29 void destroy_graph(Graph * g);
30 
31 bool make_edge(Graph * g, int from, int to, int wight);
32 
33 bool remove_edge(Graph * g, int from, int to);
34 
35 void print_graph(Graph * g);
36 
37 //algorithm
38 void dfs(Graph * g, int from);
39 
40 #endif
graph.h

相关文章:

  • 2021-04-24
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
  • 2021-12-13
  • 2022-12-23
  • 2022-03-06
  • 2021-08-11
猜你喜欢
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2021-07-15
  • 2021-09-13
  • 2021-12-07
  • 2022-01-06
相关资源
相似解决方案