Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- G1 = {1:[10], 2:[8], 3:[8], 4:[1,2,6], 5:[3,10], 6:[5,7,10], 7:[2,4,5], 8:[5,7], 9:[1,4], 10:[4,9]}
- G2 = {}
- def parcoursLargeur(G,S):
- sommetsVisite=[]
- estVisite={x:false for x in G}
- arboresence={x:x for x in G}
- def parcoursSommet(s):
- sommetsVisite.append(s)
- estVisite[s] = true
- for x in G[s]:
- if not estVisite[x]:
- parcoursSommet(x)
- arboresence[x] = s
- parcoursSommet(S)
- return sommetsVisite,arboresence
- show (parcoursLargeur(G1,3))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement