Consider the following adjacency-matrix representation of a graph,
R(V,E).
Let there be n number of vertices. So we create n*n matrix G[1..n]
[1..n]. Initially set G[i][j]=0 for all 1<= i,j <=n. This operation
will take O(V).
For each edge e of R let (a,b) be the adjacent vertices, set G[a]
[b] :=G[a][b]+1. This will take O(E).
Set parallel:= FALSE
For i=1 to n and until parallel == FALSE, do:
For j=1 to n, do:
if G[i][j]>1, then
Print "Parallel Edges detected"
Set parallel:= TRUE.
Break.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.