3.2 Graph Models

Graph Models

A Simple Graph G=(V(G),E(G)) with p vertices and q edges consists of a vertex set (or a node set) V(G)={v1,…,vp} and an edge set E(G)={e1,…,eq} where each edge is an unordered pair of vertices

An edge e=u,v is also denoted by uv or vu

graph LR;
    u((u))---|e|v((v))

The vertices contained in an edge e are its endpoints (or endnodes or endvertices), and e is said to connect u and v. An edge e=uv is said to be incident to its endpoints u and v. Two vertices that are endpoints of the same edge are said to be adjacent vertices, and two edges that are incident to the same vertex are said to be adjacent edges. Two adjacent vertices are also called neighbouring vertices.

Example

G=(V(G),E(G))
V(G)={v1,v2,v3,v4,v5}
E(G)={v1v2,v2v3,v3v4,v1v4,v2v4.v4v5}

graph LR
v1((v1))
v2((v2))
v3((v3))
v4((v4))
v5((v5))
subgraph 1;
	direction LR;
	v2---v4
	v4---v5
	v1---v2
	v2---v3
	v3---v4
	v1---v4
end
V1((v1))
V2((v2))
V3((v3))
V4((v4))
V5((v5))
subgraph 2;
	direction RL;
	V1---V4
	V3---V4
	V4---V5
	V2---V3
	V1---V2
	V2---V4
end
Types of Graphs

Simple Graphs are unweighted and undirected. They also contain no loops or parallel edges

Multigraphs (or graphs or undirected graphs) allow loops and parallel edges

Directed graphs (or digraphs) ordered edges, which are called directed edges or arcs

graph LR
v1(( ))
v2(( ))
v3(( ))
v4(( ))
v1-->v2
v2-->v4
v2-->v3
v3-->v4
v4-->v1

Weighted Graphs: Each edge e is assigned a weight w(e)

You can also have different combinations of the above models, such as directed weighted graphs, or weighted simple graphs