mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-22 13:31:21 +03:00
46 lines
1.8 KiB
C
46 lines
1.8 KiB
C
// Graph ADT interface ... COMP2521
|
|
#include <stdbool.h>
|
|
|
|
typedef struct GraphRep *Graph;
|
|
|
|
// vertices are ints
|
|
typedef int Vertex;
|
|
|
|
// edges are pairs of vertices (end-points)
|
|
typedef struct Edge
|
|
{
|
|
Vertex v;
|
|
Vertex w;
|
|
} Edge;
|
|
|
|
Graph newGraph(int);
|
|
void insertEdge(Graph, Edge);
|
|
void removeEdge(Graph, Edge);
|
|
bool adjacent(Graph, Vertex, Vertex);
|
|
void showGraph(Graph);
|
|
void freeGraph(Graph);
|
|
|
|
// By
|
|
// .----------------. .----------------. .----------------.
|
|
// .-----------------. .----------------. .----------------.
|
|
// | .--------------. || .--------------. || .--------------. ||
|
|
// .--------------. | | .--------------. || .--------------. | | | _________ |
|
|
// || | _____ _____ | || | __ | || | ____ _____ | | | | ____ ____
|
|
// | || | ____ | | | | | _ _ | | || ||_ _||_ _|| || | / \
|
|
// | || ||_ \|_ _| | | | | |_ || _| | || | .' `. | | | | |_/ | |
|
|
// \_| | || | | | | | | || | / /\ \ | || | | \ | | | | | | |
|
|
// |__| | | || | / .--. \ | | | | | | | || | | ' ' | | || |
|
|
// / ____ \ | || | | |\ \| | | | | | | __ | | || | | | | | | |
|
|
// | | _| |_ | || | \ `--' / | || | _/ / \ \_ | || | _| |_\ |_
|
|
// | | | | _| | | |_ | || | \ `--' / | | | | |_____| | || | `.__.'
|
|
// | || ||____| |____|| || ||_____|\____| | | | | |____||____| | || | `.____.'
|
|
// | | | | | || | | || | | || | | | | |
|
|
// | || | | | | '--------------' || '--------------' ||
|
|
// '--------------' || '--------------' | | '--------------' || '--------------'
|
|
// |
|
|
// '----------------' '----------------' '----------------'
|
|
// '----------------' '----------------' '----------------'
|
|
|
|
// Email : z5261243@unsw.edu.au
|
|
// hhoanhtuann@gmail.com
|