You are on page 1of 8

Artificial Intelligence

An overview
• The ability to acquire and apply knowledge and skills.
• The artificial intelligence is designing computer to learn and think as a human being.

How graphs are used in AI


• Graph is a collection of nodes or vertices between which there can be edges.
• Each node has a name.
• An edge can have an associated label which is a numeric value.

40
10 C

D
B

40 40 5

20 E
A

60 F

• Graphs can represent many scenarios.


• Edges represents the direct connections between two nodes.
• One common presentation is nodes representing destinations and edged representing
the distance between the destinations.
• These graphs can be used to find the shortest route between two nodes that are not
adjacent to each other.
• But when the graph has 100 nodes this could take a lot of time but there are many AI
algorithms that can make this process easier.

1
Dijkstra”s algorithm
This method is used to identify the shortest path to each node starting from the one of the
nodes.
The following shows the steps to be followed.

• Creates an empty set called empty nodes.


• Creates another set called remaining nodes and pull all of the nodes into this including
the source Node(S).
• Create a record that stores:
o Node names.
o Calculated values for the distance to the node from the source node.
o The sequence of node in the route to the node.
• Set the distance to the source node S as 0.
• Set the distance to all the other nodes to be INFINITY where this is to be set as a large
value.
• Check all the possible nodes to move from the current node, write their distances.
• Select the node with the shortest distance and move to that node.
Eg: 1

2
Content of Content Of the record
the shortest
path set

3
Eg 2:

Eg 3:

4
Content of Content Of the record
the shortest
path set

5
Content of Content Of the record
the shortest
path set

6
A* Method
Eg 1: Eg 2:

7
8

You might also like