9 lines
279 B
Python
9 lines
279 B
Python
def extraire_niveaux(G):
|
|
"""Extrait les niveaux des nœuds du graphe"""
|
|
niveaux = {}
|
|
for node, attrs in G.nodes(data=True):
|
|
niveau_str = attrs.get("niveau")
|
|
if niveau_str:
|
|
niveaux[node] = int(str(niveau_str).strip('"'))
|
|
return niveaux
|