ITA - Week 6 Flashcards

1
Q

What is an undirected graph

A

A pair G = (Vertices, Edges)

Each edge is an unordered pair of vertices

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a simple graph

A

At most a single edge between two vertices and no self loops

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a multigraph

A

Allows more than one edge between two vertices (can have infinite edges)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a complete graph

A

A graph with every pair of its vertices connected by an edge (all possible edges)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are adjacent vertices

A

Neighbouring vertices

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How many edges will a complete graph of n vertices have

A

N choose 2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an adjacency-list

A

A graph represented in a list which stores information about which vertex is adjacent to another vertex using a linked list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a linked list

A

A linked list is a list of elements (nodes) connected together like a chain

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What do nodes contain

A

A Data field - Data about the element

A Next field - A pointer to link the node to another

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why is a linked list useful

A

It can be used to implement a queue and stack

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the queue (FIFO) data structure

A

Elements are added (enqueue) to the tail

Elements are removed (dequeue) from the head

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does FIFO stand for

A

First in first out

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Advantage of linked list over array

A

Elements can be added and removed without reorganising the entire data structure

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a stack (LIFO) data structure

A

A data structure in which we add (push) elements to the head and remove (pop) elements from the head

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does LIFO stand for

A

Last In First Out

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the indegree of a vertex vs the outdegree

A

The number of edges leading into the vertex vs The number of edges leading away from the vertex

17
Q

What is an adjacency matrix

A

An n x n matrix where the element at row i and column j is a 1 if there is an edge from vertex i to j, otherwise it is 0

18
Q

Adjacency matrices undirected vs directed number of elements

A

Undirected: n(n-1)/2
Directed: n(n-1)

19
Q

What is a sparse graph

A

Few edges- Adjacency lists use less space

Dense graph - Adjacency matrices use less space

20
Q

What makes a simple path

A

If all vertices in the path are distinct

21
Q

Path definition

A

Between vertex u and v in a graph is a sequence of edges (u,x1), (x1, x2),…(xn-1, v)

22
Q

Euler cycle definition

A

An euler cycle in a graph G is a cycle visiting every edge exactly once

23
Q

What makes a cycle euler

A

If the degree of all nodes are even

24
Q

When is a graph called a tree

A

If the graph is connected and acyclic

25
Q

When is a graph called a forest

A

When the graph has no cycles but isn’t necessarily connected

26
Q

What is the root of the tree

A

The topmost vertex

27
Q

What is the degree of a tree

A

The maximum degree of all vertices