La présentation est en train de télécharger. S'il vous plaît, attendez

La présentation est en train de télécharger. S'il vous plaît, attendez

Structures de données et algorithmes – TP7 Maria-Iuliana Dascalu, PhD

Présentations similaires


Présentation au sujet: "Structures de données et algorithmes – TP7 Maria-Iuliana Dascalu, PhD"— Transcription de la présentation:

1 Structures de données et algorithmes – TP7 Maria-Iuliana Dascalu, PhD mariaiuliana.dascalu@gmail.com

2 Ex. 1 Prenons un graphe non orienté, représentant un réseau social. Compte tenu d'un utilisateur, affichez tous ses amis (ou des informations sur ceux-ci) ayant le degré <= N (N est donnée). A est ami avec B s'il existe une arête entre A et B, nous disons que le degré de l'amitié est de 1. Amis de mes amis ont le degré d'amitié 2. En anglais: Let’s consider un undirected graph, representing a social network. Given an user, display all his friends (or information about them) having the degree <=N (N is given). A is friend with B if there is an edge between A and B; we say that the degree of friendship is 1. Friends of friends have the degree of friendship 2.

3 Ex. 2 Graphe est bipartite ou non? Vérifier si un graphe est bipartite et, si oui, afficher les éléments de ces deux ensembles A et B. Vérifiez votre code pour les graphes suivants: – G1=({ 1,2,3,4,5,6,7,8,9},{ 12, 13, 45, 56, 75, 24, 58, 79, 43, 89}) – G2=({ 1,2,3,4,5,6,7,8,9},{ 12, 13, 45, 56, 75, 24, 58, 79, 43, 89,47})

4 Tips In the mathematical field of graph theory, a bipartite graph (or bigraph) is a graph whose vertices can be divided into two disjoint sets and such that every edge connects a vertex in to one in ; that is, and are each independent sets. Equivalently, a bipartite graph is a graph that does not contain any odd- length cycles.(Wikipedia) Use BFS: http://www.personal.kent.edu/~rmuham ma/Algorithms/MyAlgorithms/Graph Algor/breadthSearch.htm Tous les exercices non résolus seront présentés lors de la prochaine fois.


Télécharger ppt "Structures de données et algorithmes – TP7 Maria-Iuliana Dascalu, PhD"

Présentations similaires


Annonces Google