Graphs Flashcards
Graph Definition
a collection of vertices (or nodes) and the connections between them
simple graph G = (V, E)
consists of a nonempty set V of vertices and a possibly empty set E of edges, each edge being a set of two vertices from V.
The number of vertices and edges is denoted by ___ and ____, respectively.
|V|, |E|
A directed graph, or a digraph, G = (V, E)
consists of a nonempty set V of vertices and a set E of edges (also called arcs), where each edge is a pair of verices from V.
One edge of a simple graph is of the form ___ and ____ = _____
{vi, vj}; {vi, vj} = {vj, vi}
In a digraph, each edge is of the form ___ and ____ != _____
(vi, vj); (vi, vj) != (vj, vi)
Miltigraph
- a graph in which two vertices can be joing by multiple edges
a multigraph G = (V, E, f) is composed of a set of vertices V, a set of edges E, and a function f: E → {{vi,vj} : vi,vj ∈ V and vi != vj}
Pseudograph
a multigraph that allows edges that connect vertices to themselves – these edges are known as loops
Path
a path from v1 to vn is a sequence of edges edge(v1 v2), edge(v2 v3), . . . ,
edge (vn-1 vn) and is denoted as a sequence of vertices v1, v2, v3, . . . , vn-1 , vn
Circiut
a path where v1 = vn and no edge is repeated
Cycle
path where all vertices in a circuit are different
Weighted Graph
A graph where each edge has an assigned number.
The number assigned to an edge is called its weight, cost, distance, length . . . depending on the context
Complete Graph
A graph with n vertices such that for each pair of distinct vertices there is exactly one edge connecting them; that is, each vertex can be connected to any other vertex.
degree of a vertex
The degree of a vertex v, deg(v), is the number of edges incident with v.
isolated vertex
vertex where degree is 0
( deg(v) = 0 )
Adjacent Vertices
Two vertices vi and vj if the edge(vi vj) is in E.
edge(v, w) in E:
* w is said to be adjacent to v
* if graph is undirected then v is also adjacent to w
* such an edge is called incident with the vertices v and w
Subgraph
A subgraph G’ of graph G = (V, E) such that V’ ⊆ V and E’ ⊆ E.
A subgraph _______ by vertices V’ is a graph (V’, E’) such that an edge e ∈ E if ______
induced, e ∈ E’
A path’s length
is the number of edges that compose it
Acyclic Graph (DAG)
A directed graph without cycles
A ____ in a directed graph is a path of lengtha at least __ such that v1 = vn
cycle, 1
Adjacency List
A simple representation of a graph which specifies all vertices adjacent to each vertex of the graph.
Implementations:
- Star representation: list implemented as a table
- Linked List
Adjacency Matrix of Graph G = (V, E)
a binary |V| x |V| matrix indexed form 0 to n-1 such that each entry of this matrix:
aij = 1 if edge ej is incident with vertex vi; 0 otherwise
*Each row i represents vertices adjacent to vertex vi, with
** order of vertices in adjacency matrix is arbitrary; there are n! possible adjacency matrices for the same graph G
An incidence matrix of graph G = (V, E)
Representation of a graph based on the incidence of vertices and edges.
|V| x |E| matrix such that a<strong>ij</strong> =
1 if edge ej is incident with vertex vi
0 otherwise