Graph
Graph
Classification
1-UnDirect: dual arc with no arrow 2-Dirtect: arc with arrow (1 direction)
Vertex Degree
to calc the degree for each vertex
Undirected: number of edges connected with it (ex: 3 have 2 edges coming out of it,
degree(3)=2
sum of degree=2e=2*edges
Directed: 1-in degree(edges coming in v) 2-out degree(edges coming out of vertex)
sum of edges= sum in+sum out
Ex:
2-List
1)Linear list
-create list for each vertex
-write with each list the connected nodes
ex: list[1]=(2,4)
cost: (weighted graph)
C(i,j)=cost of edge(i,j)
2)Linked list
-draw array of n
-each list of array(vertex) connected to a linked list with the connected nodes
cost: (weighted graph)
each list is a pair
Ex: