/DistanceVector

The distance vector algorithm implemented over a weighted graph.

Primary LanguagePHP

The result of running the script is:

Step 0
---------------------------------
 	A	B	C	D	E	F	G	H	
A	0	14	2	INF	INF	INF	INF	INF
B	14	0	8	INF	1	3	INF	INF
C	2	8	0	INF	INF	INF	1	INF
D	INF	INF	INF	0	7	10	INF	INF
E	INF	1	INF	7	0	1	INF	INF
F	INF	3	INF	10	1	0	3	1
G	INF	INF	1	INF	INF	3	0	5
H	INF	INF	INF	INF	INF	1	5	0

Step 1
---------------------------------
 	A	B	C	D	E	F	G	H	
A	0	10	2	INF	15	17	3	INF
B	10	0	8	8	1	2	6	4
C	2	8	0	INF	9	4	1	6
D	INF	8	INF	0	7	8	13	11
E	15	1	9	7	0	1	4	2
F	17	2	4	8	1	0	3	1
G	3	6	1	13	4	3	0	4
H	INF	4	6	11	2	1	4	0

Step 2
---------------------------------
 	A	B	C	D	E	F	G	H	
A	0	10	2	18	11	6	3	8
B	10	0	6	8	1	2	5	3
C	2	7	0	14	5	4	1	5
D	22	8	12	0	7	8	11	9
E	11	1	5	7	0	1	4	2
F	6	2	4	8	1	0	3	1
G	3	5	1	11	4	3	0	4
H	7	3	5	9	2	1	4	0

Step 3
---------------------------------
 	A	B	C	D	E	F	G	H	
A	0	9	2	16	7	6	3	7
B	8	0	6	8	1	2	5	3
C	2	6	0	12	5	4	1	5
D	14	8	12	0	7	8	11	9
E	7	1	5	7	0	1	4	2
F	6	2	4	8	1	0	3	1
G	3	5	1	11	4	3	0	4
H	7	3	5	9	2	1	4	0

Step 4
---------------------------------
 	A	B	C	D	E	F	G	H	
A	0	8	2	14	7	6	3	7
B	8	0	6	8	1	2	5	3
C	2	6	0	12	5	4	1	5
D	14	8	12	0	7	8	11	9
E	7	1	5	7	0	1	4	2
F	6	2	4	8	1	0	3	1
G	3	5	1	11	4	3	0	4
H	7	3	5	9	2	1	4	0