mirror of https://github.com/TheAlgorithms/C
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
|