Está en la página 1de 20

Graphs

Definition:
a graph is an abstract representation of a
set of objects where some pairs of the
objects are connected by links. The
interconnected objects are represented by
mathematical abstractions called vertices,
and the links that connect some pairs of
vertices are called edges.

B
C
F
A

A vertex is a point where edges


meet
B
C
F
A

An edge can start and end at the same


vertex

A vertex is a point where edges


meet
B
C
F
A

An edge can start and end at the same


vertex

A vertex is a point where edges


meet
B
C
F
A

Vertices are also known as


nodes
Edges are also known as

A weight is a number associated with


an edge
B
C
F
A

A weight is a number associated with


an edge
B
8
C

3
F

5
A
4

6
E

This could represent a distance, time


or cost

A path runs from one vertex to another


along edges
B
8
C

3
F

5
A
4

6
E

but no vertex is passed through more


than once

A path runs from one vertex to another


along edges
B
8
C

3
F

5
A
4

6
E

but no vertex is passed through more


than once

A closed path returns to


the start
B
8
C

3
F

5
A
4

6
E

A closed path returns to


the start
B
8
C

3
F

5
A
4

6
E

This is also known as a circuit or


cycle

In a connected graph it is possible to find


a path between any two vertices:
B
8
C

3
F

5
A
4

6
E

This graph is not connected:


B
8
C
F

5
A

5
4
6
E

A tree is a connected graph of some


vertices which contains no cycles
B
8
C

3
F

5
A
4

6
E

A tree is a connected graph of some


vertices which contains no cycles
B
C

2
5

A
3
6
E

A spanning tree is a connected graph of


all vertices which contains no cycles
B
C

3
5

A
3
6
E

The minimum spanning tree is the


spanning tree with the least weight
B
C

3
5

A
3
6
E

Length of this tree


is 19

The minimum spanning tree is the


spanning tree with the least weight
B
8
C

3
F

5
A
4

6
E

Can you find the least


weight?

The minimum spanning tree is the


spanning tree with the least weight
B
8
C

3
F

5
A
4

6
E

The least weight


is 15

The minimum spanning tree is the


spanning tree with the least weight
B
C

3
F

5
A

The least weight


is 15

También podría gustarte