In [2]:
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
In [2]:
# Pour voir le contenu de la bibliothèque
# import networkx
# dir(networkx)
In [4]:
# pour avoir de l'aide sur la commande is_connected par exemple
# help(networkx.is_connected)

Premier exemple

In [5]:
# déclaration d'un graphe dans la variable g
g=nx.Graph() # Graph, non orienté. Digraph, orienté.
# déclare que le graphe de g contient 5 sommets
g.add_nodes_from(range(5))
# définit les arêtes entre les sommets, par exemple (4,5) déclare une arête entre le sommet 4 et 5 
# si on rajoute dans la liste des sommets non déclarés ils sont ajoutés ici on a ajouté le sommet 5
g.add_edges_from([(0,1),(3,4),(4,2),(1,3),(4,0),(1,2),(1,5)])

plt.figure()
nx.draw(g)
plt.show()

Deuxième exemple

In [4]:
g = nx.newman_watts_strogatz_graph(100, 15, 0.35, seed = 12345 )

plt.figure()
nx.draw(g)
plt.show()

Création d'un graphe à partir d'une matrice d'adjacence

In [10]:
# déclaration de la matrice M
M = np.array([[0,0,1,1],
              [1,1,0,0],
              [0,1,0,1],
              [1,0,1,0]])
# affichage de la matrice
print(M)
[[0 0 1 1]
 [1 1 0 0]
 [0 1 0 1]
 [1 0 1 0]]
In [11]:
# affichage du graphe associé à la matrice d'ajacence M
plt.figure()
nx.draw(nx.DiGraph(M))
plt.show()
In [12]:
options = {
    'node_color' : 'yellow',         # couleur des sommets
      'node_size'  : 550,            # taille des sommets
      'edge_color' : 'tab:blue',     # couleur des arêtes
      'with_labels': True            # affiche l'étiquette des sommets
}
#DiGraph permet de faire des graphes orienté
G = nx.DiGraph(M)
plt.figure()
nx.draw(G, **options)
                #**options fait référence à la variable options contenant toutes les informations de mise en page du graphe
plt.show()

Exercice tiré d'un ancien bac

Une agence de tourisme propose la visite de certains monuments parisiens.

Chacun de ces monuments est désigné par une lettre comme suit :

E : Tour Eiffel

L : Musée du Louvre

M : Tour Montparnasse

N : Cathédrale Notre-Dame de Paris

S : Basilique du Sacré-Cœur de Montmartre

T : Arc de triomphe

Cette agence fait appel à une société de transport par autocar qui propose les liaisons suivantes (chacune de ces liaisons pouvant s’effectuer dans les deux sens de circulation) :

In [20]:
g=nx.Graph()
# on définit les arêtes du graph en respectant les donnés de l'énoncé
g.add_edges_from([('S','T'),('S','E'),('S','N'),('T','E'),('E','L'),('E','M'),('L','N'),('M','N'),('L','M'),('L','S')])
options = {
    'node_color' : 'yellow',
      'node_size'  : 550,
      'edge_color' : 'tab:grey',
      'with_labels': True
}
plt.figure()
nx.draw(g, **options)
plt.show()
In [14]:
# Recherche des degrés des sommets
# La liste des degrés est un dictionnaire.



ListeDegres={}

for x in g.nodes() : 
    ListeDegres[x]=g.degree(x)
In [15]:
ListeDegres
Out[15]:
{'S': 4, 'T': 2, 'E': 4, 'N': 3, 'L': 4, 'M': 3}
In [16]:
# Graphes Eulériens
nx.is_eulerian(g)
nx
Out[16]:
<module 'networkx' from 'C:\\Users\\Pascal\\Anaconda3\\lib\\site-packages\\networkx\\__init__.py'>

Il n'existe pas de parcours eulérien dans un graphe non Eulérien d'implanté dans networkx, il faut le programmer soit même. Un site intéressant qui cherche ce parcours avec l'algorithme de Fleury.

https://repl.it/@PascalTherese/Fleurys-Algorithm

Pour les courageux, on peut aussi l'implanter.

Quelques éléments sur les matrices

In [15]:
# Créer la matrice d'adjacence

adjacence = np.array([[0,1,1,0,1,1],
              [1,0,1,1,1,0],
              [1,1,0,1,0,0],
              [0,1,1,0,1,0],
                [1,1,0,1,0,1],
                    [1,0,0,0,1,0]])
In [16]:
print(adjacence)
[[0 1 1 0 1 1]
 [1 0 1 1 1 0]
 [1 1 0 1 0 0]
 [0 1 1 0 1 0]
 [1 1 0 1 0 1]
 [1 0 0 0 1 0]]
In [17]:
  # pour calculer le produit    
    
AdjaCarre=np.dot(adjacence,adjacence)
In [18]:
AdjCube=np.dot(AdjaCarre,adjacence)
In [19]:
AdjCube
Out[19]:
array([[ 6, 10,  9,  5, 10,  6],
       [10,  8,  8,  8, 10,  4],
       [ 9,  8,  4,  8,  5,  4],
       [ 5,  8,  8,  4,  9,  4],
       [10, 10,  5,  9,  6,  6],
       [ 6,  4,  4,  4,  6,  2]])
In [ ]:
 
In [24]:
# Créer la matrice d'adjacence pour qu'elle tienne compte des poids

inf = float("inf")  # on utilisera inf pour symboliser l'absence d'arcs

adjacencePoids = np.array([[inf,8,10,inf,10,4],
              [8,inf,7,2,5,inf],
              [10,7,inf,1,inf,inf],
              [inf,2,4,inf,8,inf],
                [10,5,inf,8,inf,8],
                    [4,inf,inf,inf,8,inf]])
print(adjacencePoids)
[[inf  8. 10. inf 10.  4.]
 [ 8. inf  7.  2.  5. inf]
 [10.  7. inf  1. inf inf]
 [inf  2.  4. inf  8. inf]
 [10.  5. inf  8. inf  8.]
 [ 4. inf inf inf  8. inf]]

Algorithme de Dijkstra

In [17]:
g=nx.Graph()
#('S','T',{'weight':8}) permet de définir une arête entre les sommets S et T avec une pondération de 8
g.add_edges_from([('S','T',{'weight':8}),('S','E',{'weight':10}),('S','N',
                  {'weight':8}),('T','E',{'weight':4}),('E','L',{'weight':8}),
                  ('E','M',{'weight':10}),('L','N',{'weight':2}),('M','N',
                  {'weight':4}),('L','M',{'weight':7}),('L','S',{'weight':5})])
options = {
    'node_color' : 'yellow',
      'node_size'  : 550,
      'edge_color' : 'tab:grey',
      'with_labels': True
}
plt.figure()
nx.draw(g, **options)
plt.show()
In [18]:
nx.dijkstra_path_length(g,'M','S')
Out[18]:
11

Exemple d'un graphe complet

recherche d'un circuit Eulérien.

In [19]:
g=nx.complete_graph(5)

plt.figure()
nx.draw(g)
plt.show()
nx.is_eulerian(g)
list(nx.eulerian_circuit(g))
Out[19]:
[(0, 4),
 (4, 3),
 (3, 2),
 (2, 4),
 (4, 1),
 (1, 3),
 (3, 0),
 (0, 2),
 (2, 1),
 (1, 0)]
In [ ]:
 

Simulation à l'aide d'une matrice d'adjacence: simulation d'un réseau social

  • Le problème de notre simulation est que les interactions sont de l'odre une chance sur deux.
  • Il faudrait une activité en classe réelle avec les élèves pour comparer les matrices d'adjacence.
  • Dans networkx, il y a des méthodes de simulation de réseaux aléatoires. Exemple aves la méthode Barabasi.
In [22]:
# première méthode
n=10
adj= np.around(np.random.rand(n,n))
In [23]:
# deuxième méthode

matrix2=np.random.randint(2,size=(n,n))
In [23]:
print(adj)
[[1. 0. 1. 0. 0. 0. 0. 0. 1. 0.]
 [1. 0. 1. 0. 0. 1. 1. 0. 0. 1.]
 [1. 0. 0. 1. 0. 0. 1. 1. 1. 1.]
 [0. 0. 1. 0. 1. 1. 1. 0. 1. 0.]
 [0. 1. 0. 0. 0. 1. 0. 0. 0. 0.]
 [1. 0. 1. 0. 0. 0. 1. 1. 0. 0.]
 [1. 0. 0. 0. 0. 0. 1. 1. 1. 0.]
 [1. 1. 0. 1. 1. 1. 0. 0. 1. 0.]
 [1. 0. 0. 0. 0. 1. 1. 1. 1. 0.]
 [0. 0. 1. 0. 1. 1. 0. 1. 0. 1.]]
In [24]:
print(matrix2)
[[0 0 1 0 1 0 0 1 1 1]
 [0 0 0 0 1 1 1 0 1 0]
 [0 1 0 1 0 1 1 1 1 0]
 [1 0 1 0 0 1 0 1 0 1]
 [0 0 0 0 0 0 1 1 0 1]
 [0 0 0 0 0 1 1 1 1 1]
 [0 1 1 0 0 0 0 0 1 1]
 [1 0 1 1 0 0 0 1 1 1]
 [1 0 1 1 1 0 0 0 1 0]
 [0 1 1 0 0 0 1 0 1 1]]
In [ ]:
 
In [25]:
graph = nx.DiGraph(adj)

options = {
    'node_color' : 'yellow',
      'node_size'  : 550,
      'edge_color' : 'tab:grey',
      'with_labels': True
}
plt.figure()
nx.draw(graph, **options)

plt.show()
In [21]:
# Dans networkx, il y a des méthodes de simulation de réseaux aléatoires. Exemple aves la méthode Barabasi.

node_number = 10 
initial_nodes = 2 
G = nx.barabasi_albert_graph(node_number, initial_nodes) 



options = {
    'node_color' : 'yellow',
      'node_size'  : 550,
      'edge_color' : 'tab:grey',
      'with_labels': True
}
plt.figure()
nx.draw(G, **options)

plt.show()

Lien très intéressant :

https://iut-info.univ-reims.fr/users/blanchard/ISN20181218/utilisation-de-la-bibliotheque-networkx.html#analyse-dun-reseau-social-dorques

Les outils de networkx pour l'anayse des graphes :

  • g.degree() : degrés des sommets du graphe g
  • g.number_of_nodes() : nombre de sommets du graphe g
  • g.number_of_edges() : nombre d’arcs du graphe g
  • g.predecessors(i) : liste des prédecesseurs du sommet i, le graphe doit être orienté, à utiliser avec list()
  • g.successors(i) : liste des successeurs du sommet i, le graphe doit être orienté, à utiliser avec list()
  • g.neighbors(i) : liste des voisins du sommet i, le graphe doit être orienté à utiliser avec list()

On dispose aussi des indicateurs et outils suivants (liste non exhaustive) :

  • density(g) : densité du graphe g
  • diameter(g) : diamètre du graphe g
  • shortest_path(g) : plus courts chemins entre tous les couples de sommets de g
  • pagerank(g) : calcul du pagerank
  • center(g) : centre
  • periphery(g) : périphérie
  • eccentricity(G)
In [60]:
print(G.degree())
print(G.number_of_nodes())
print(G.number_of_edges())

# pour les successeurs, prédecesseurs, utilisatin d'ungraphe orienté .

print(list(graph.predecessors(2)))
print(list(graph.successors(2)))
print(list(graph.neighbors(2)))
[(0, 6), (1, 4), (2, 2), (3, 5), (4, 3), (5, 3), (6, 3), (7, 2), (8, 2), (9, 2)]
10
16
[3, 4, 5, 6, 8, 9]
[5, 6]
[5, 6]
In [46]:
print(nx.density(G))
print(nx.diameter(G))
print(nx.shortest_path(G))
print(nx.pagerank(G))
print(nx.center(G))
print(nx.periphery(G))
0.35555555555555557
3
{0: {0: [0], 2: [0, 2], 3: [0, 3], 6: [0, 6], 7: [0, 7], 8: [0, 8], 9: [0, 9], 1: [0, 2, 1], 4: [0, 3, 4], 5: [0, 3, 5]}, 1: {1: [1], 2: [1, 2], 3: [1, 3], 4: [1, 4], 5: [1, 5], 0: [1, 2, 0], 6: [1, 3, 6], 8: [1, 4, 8], 7: [1, 5, 7], 9: [1, 2, 0, 9]}, 2: {2: [2], 0: [2, 0], 1: [2, 1], 3: [2, 0, 3], 6: [2, 0, 6], 7: [2, 0, 7], 8: [2, 0, 8], 9: [2, 0, 9], 4: [2, 1, 4], 5: [2, 1, 5]}, 3: {3: [3], 0: [3, 0], 1: [3, 1], 4: [3, 4], 5: [3, 5], 6: [3, 6], 2: [3, 0, 2], 7: [3, 0, 7], 8: [3, 0, 8], 9: [3, 0, 9]}, 4: {4: [4], 1: [4, 1], 3: [4, 3], 8: [4, 8], 2: [4, 1, 2], 5: [4, 1, 5], 0: [4, 3, 0], 6: [4, 3, 6], 7: [4, 1, 5, 7], 9: [4, 3, 0, 9]}, 5: {5: [5], 1: [5, 1], 3: [5, 3], 7: [5, 7], 2: [5, 1, 2], 4: [5, 1, 4], 0: [5, 3, 0], 6: [5, 3, 6], 8: [5, 1, 4, 8], 9: [5, 3, 0, 9]}, 6: {6: [6], 0: [6, 0], 3: [6, 3], 9: [6, 9], 2: [6, 0, 2], 7: [6, 0, 7], 8: [6, 0, 8], 1: [6, 3, 1], 4: [6, 3, 4], 5: [6, 3, 5]}, 7: {7: [7], 0: [7, 0], 5: [7, 5], 2: [7, 0, 2], 3: [7, 0, 3], 6: [7, 0, 6], 8: [7, 0, 8], 9: [7, 0, 9], 1: [7, 5, 1], 4: [7, 0, 3, 4]}, 8: {8: [8], 0: [8, 0], 4: [8, 4], 2: [8, 0, 2], 3: [8, 0, 3], 6: [8, 0, 6], 7: [8, 0, 7], 9: [8, 0, 9], 1: [8, 4, 1], 5: [8, 0, 3, 5]}, 9: {9: [9], 0: [9, 0], 6: [9, 6], 2: [9, 0, 2], 3: [9, 0, 3], 7: [9, 0, 7], 8: [9, 0, 8], 1: [9, 0, 2, 1], 4: [9, 0, 3, 4], 5: [9, 0, 3, 5]}}
{0: 0.18061758225169103, 1: 0.12163334137396738, 2: 0.06643439026747143, 3: 0.14657245755417125, 4: 0.09437933874386188, 5: 0.09437933874386188, 6: 0.09408378106060411, 7: 0.0673277704555431, 8: 0.0673277704555431, 9: 0.06724422909328473}
[0, 2, 3, 6]
[1, 4, 5, 7, 8, 9]

Un graphe en modifiant la largeur des arêtes en fonction du poids

In [3]:
import networkx as nx

G = nx.DiGraph()
G.add_edge(1,2,color='r',weight=2)
G.add_edge(2,3,color='b',weight=4)
G.add_edge(3,4,color='g',weight=6)
#pour positionner les sommets de manière circulaire
pos = nx.circular_layout(G)
#pour créer la liste des arêtes
edges = G.edges()
print(edges)
#pour créer la liste des couleurs des arêtes
colors = [G[u][v]['color'] for u,v in edges]
#pour créer la liste des poids qui donneront la largeur des arêtes
weights = [G[u][v]['weight'] for u,v in edges]
options = {
    'node_color' : 'yellow',
      'node_size'  : 550,
      'edge_color' : 'tab:grey',
      'with_labels': True
}
#nx.Draw{G,**options}
nx.draw(G,pos, node_color='yellow',with_labels=True,edges=edges, edge_color=colors, width=weights)
[(1, 2), (2, 3), (3, 4)]

Un graphe avec indication des poids sur les arêtes

In [71]:
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
import pylab

G = nx.DiGraph()

G.add_edges_from([('A', 'B'),('C','D'),('G','D')], weight=1)
G.add_edges_from([('D','A'),('D','E'),('B','D'),('D','E')], weight=2)
G.add_edges_from([('B','C'),('E','F')], weight=3)
G.add_edges_from([('C','F')], weight=4)


val_map = {'A': 1.0,
                   'D': 0.5714285714285714,
                              'H': 0.0}

values = [val_map.get(node, 0.45) for node in G.nodes()]
edge_labels=dict([((u,v,),d['weight'])
                 for u,v,d in G.edges(data=True)])
red_edges = [('C','D'),('D','A')]
edge_colors = ['black' if not edge in red_edges else 'red' for edge in G.edges()]

pos=nx.circular_layout(G)
#commande pour faire des arêtes avec indication de poids
# commande qui utilise pylab
nx.draw_networkx_edge_labels(G,pos,edge_labels=edge_labels)
#commande pour tracer le graphe
nx.draw(G,pos, node_color = values,with_labels=True, node_size=1500,edge_color=edge_colors,edge_cmap=plt.cm.Reds)
pylab.show()
In [6]:
import networkx
dir(networkx)
Out[6]:
['AmbiguousSolution',
 'DiGraph',
 'ExceededMaxIterations',
 'Graph',
 'GraphMLReader',
 'GraphMLWriter',
 'HasACycle',
 'LCF_graph',
 'MultiDiGraph',
 'MultiGraph',
 'NetworkXAlgorithmError',
 'NetworkXError',
 'NetworkXException',
 'NetworkXNoCycle',
 'NetworkXNoPath',
 'NetworkXNotImplemented',
 'NetworkXPointlessConcept',
 'NetworkXTreewidthBoundExceeded',
 'NetworkXUnbounded',
 'NetworkXUnfeasible',
 'NodeNotFound',
 'NotATree',
 'OrderedDiGraph',
 'OrderedGraph',
 'OrderedMultiDiGraph',
 'OrderedMultiGraph',
 'PlanarEmbedding',
 'PowerIterationFailedConvergence',
 '__author__',
 '__bibtex__',
 '__builtins__',
 '__cached__',
 '__date__',
 '__doc__',
 '__file__',
 '__license__',
 '__loader__',
 '__name__',
 '__package__',
 '__path__',
 '__spec__',
 '__version__',
 'absolute_import',
 'adamic_adar_index',
 'add_cycle',
 'add_path',
 'add_star',
 'adj_matrix',
 'adjacency',
 'adjacency_data',
 'adjacency_graph',
 'adjacency_matrix',
 'adjacency_spectrum',
 'adjlist',
 'algebraic_connectivity',
 'algebraicconnectivity',
 'algorithms',
 'all',
 'all_neighbors',
 'all_node_cuts',
 'all_pairs_bellman_ford_path',
 'all_pairs_bellman_ford_path_length',
 'all_pairs_dijkstra',
 'all_pairs_dijkstra_path',
 'all_pairs_dijkstra_path_length',
 'all_pairs_lowest_common_ancestor',
 'all_pairs_node_connectivity',
 'all_pairs_shortest_path',
 'all_pairs_shortest_path_length',
 'all_shortest_paths',
 'all_simple_paths',
 'all_topological_sorts',
 'ancestors',
 'antichains',
 'approximate_current_flow_betweenness_centrality',
 'articulation_points',
 'assortativity',
 'astar',
 'astar_path',
 'astar_path_length',
 'atlas',
 'attr_matrix',
 'attr_sparse_matrix',
 'attracting',
 'attracting_component_subgraphs',
 'attracting_components',
 'attribute_assortativity_coefficient',
 'attribute_mixing_dict',
 'attribute_mixing_matrix',
 'attrmatrix',
 'authority_matrix',
 'average_clustering',
 'average_degree_connectivity',
 'average_neighbor_degree',
 'average_node_connectivity',
 'average_shortest_path_length',
 'balanced_tree',
 'barabasi_albert_graph',
 'barbell_graph',
 'beamsearch',
 'bellman_ford_path',
 'bellman_ford_path_length',
 'bellman_ford_predecessor_and_distance',
 'betweenness',
 'betweenness_centrality',
 'betweenness_centrality_source',
 'betweenness_centrality_subset',
 'betweenness_subset',
 'bfs_beam_edges',
 'bfs_edges',
 'bfs_predecessors',
 'bfs_successors',
 'bfs_tree',
 'biconnected',
 'biconnected_component_edges',
 'biconnected_component_subgraphs',
 'biconnected_components',
 'bidirectional_dijkstra',
 'bidirectional_shortest_path',
 'binary',
 'binomial_graph',
 'bipartite',
 'bipartite_layout',
 'boundary',
 'boundary_expansion',
 'breadth_first_search',
 'bridges',
 'bull_graph',
 'capacity_scaling',
 'cartesian_product',
 'caveman_graph',
 'center',
 'centrality',
 'chain_decomposition',
 'chains',
 'check_planarity',
 'chordal',
 'chordal_cycle_graph',
 'chordal_graph_cliques',
 'chordal_graph_treewidth',
 'chvatal_graph',
 'circulant_graph',
 'circular_ladder_graph',
 'circular_layout',
 'classes',
 'classic',
 'clique',
 'cliques_containing_node',
 'closeness',
 'closeness_centrality',
 'closeness_vitality',
 'cluster',
 'clustering',
 'cn_soundarajan_hopcroft',
 'coloring',
 'common_neighbors',
 'communicability',
 'communicability_alg',
 'communicability_betweenness_centrality',
 'communicability_exp',
 'community',
 'complement',
 'complete_bipartite_graph',
 'complete_graph',
 'complete_multipartite_graph',
 'components',
 'compose',
 'compose_all',
 'condensation',
 'conductance',
 'configuration_model',
 'connected',
 'connected_caveman_graph',
 'connected_component_subgraphs',
 'connected_components',
 'connected_double_edge_swap',
 'connected_watts_strogatz_graph',
 'connectivity',
 'constraint',
 'contracted_edge',
 'contracted_nodes',
 'convert',
 'convert_matrix',
 'convert_node_labels_to_integers',
 'core',
 'core_number',
 'coreviews',
 'correlation',
 'cost_of_flow',
 'could_be_isomorphic',
 'covering',
 'create_empty_copy',
 'cubical_graph',
 'current_flow_betweenness',
 'current_flow_betweenness_centrality',
 'current_flow_betweenness_centrality_subset',
 'current_flow_betweenness_subset',
 'current_flow_closeness',
 'current_flow_closeness_centrality',
 'cut_size',
 'cuts',
 'cycle_basis',
 'cycle_graph',
 'cycles',
 'cytoscape',
 'cytoscape_data',
 'cytoscape_graph',
 'dag',
 'dag_longest_path',
 'dag_longest_path_length',
 'dag_to_branching',
 'davis_southern_women_graph',
 'degree',
 'degree_alg',
 'degree_assortativity_coefficient',
 'degree_centrality',
 'degree_histogram',
 'degree_mixing_dict',
 'degree_mixing_matrix',
 'degree_pearson_correlation_coefficient',
 'degree_seq',
 'degree_sequence_tree',
 'dense',
 'dense_gnm_random_graph',
 'density',
 'depth_first_search',
 'desargues_graph',
 'descendants',
 'dfs_edges',
 'dfs_labeled_edges',
 'dfs_postorder_nodes',
 'dfs_predecessors',
 'dfs_preorder_nodes',
 'dfs_successors',
 'dfs_tree',
 'diameter',
 'diamond_graph',
 'difference',
 'digraph',
 'dijkstra_path',
 'dijkstra_path_length',
 'dijkstra_predecessor_and_distance',
 'directed',
 'directed_configuration_model',
 'directed_havel_hakimi_graph',
 'directed_laplacian_matrix',
 'directed_modularity_matrix',
 'disjoint_union',
 'disjoint_union_all',
 'dispersion',
 'distance_measures',
 'distance_regular',
 'dodecahedral_graph',
 'dominance',
 'dominance_frontiers',
 'dominating',
 'dominating_set',
 'dorogovtsev_goltsev_mendes_graph',
 'double_edge_swap',
 'draw',
 'draw_circular',
 'draw_kamada_kawai',
 'draw_networkx',
 'draw_networkx_edge_labels',
 'draw_networkx_edges',
 'draw_networkx_labels',
 'draw_networkx_nodes',
 'draw_random',
 'draw_shell',
 'draw_spectral',
 'draw_spring',
 'drawing',
 'duplication',
 'duplication_divergence_graph',
 'eccentricity',
 'edge_betweenness',
 'edge_betweenness_centrality',
 'edge_betweenness_centrality_subset',
 'edge_bfs',
 'edge_boundary',
 'edge_connectivity',
 'edge_current_flow_betweenness_centrality',
 'edge_current_flow_betweenness_centrality_subset',
 'edge_dfs',
 'edge_disjoint_paths',
 'edge_expansion',
 'edge_load_centrality',
 'edge_subgraph',
 'edgebfs',
 'edgedfs',
 'edgelist',
 'edges',
 'effective_size',
 'efficiency',
 'ego',
 'ego_graph',
 'eigenvector',
 'eigenvector_centrality',
 'eigenvector_centrality_numpy',
 'empty_graph',
 'enumerate_all_cliques',
 'erdos_renyi_graph',
 'estrada_index',
 'euler',
 'eulerian_circuit',
 'eulerize',
 'exception',
 'expanders',
 'expected_degree_graph',
 'extended_barabasi_albert_graph',
 'extrema_bounding',
 'fast_could_be_isomorphic',
 'fast_gnp_random_graph',
 'faster_could_be_isomorphic',
 'fiedler_vector',
 'filters',
 'find_cliques',
 'find_cliques_recursive',
 'find_cores',
 'find_cycle',
 'find_induced_nodes',
 'florentine_families_graph',
 'flow',
 'flow_hierarchy',
 'flow_matrix',
 'floyd_warshall',
 'floyd_warshall_numpy',
 'floyd_warshall_predecessor_and_distance',
 'freeze',
 'from_dict_of_dicts',
 'from_dict_of_lists',
 'from_edgelist',
 'from_graph6_bytes',
 'from_nested_tuple',
 'from_numpy_array',
 'from_numpy_matrix',
 'from_pandas_adjacency',
 'from_pandas_edgelist',
 'from_prufer_sequence',
 'from_scipy_sparse_matrix',
 'from_sparse6_bytes',
 'frucht_graph',
 'fruchterman_reingold_layout',
 'full_rary_tree',
 'function',
 'gaussian_random_partition_graph',
 'general_random_intersection_graph',
 'generalized_degree',
 'generate_adjlist',
 'generate_edgelist',
 'generate_gexf',
 'generate_gml',
 'generate_graphml',
 'generate_multiline_adjlist',
 'generate_pajek',
 'generators',
 'generic',
 'geographical_threshold_graph',
 'geometric',
 'get_edge_attributes',
 'get_node_attributes',
 'gexf',
 'global_efficiency',
 'global_parameters',
 'global_reaching_centrality',
 'gml',
 'gn_graph',
 'gnc_graph',
 'gnm_random_graph',
 'gnp_random_graph',
 'gnr_graph',
 'goldberg_radzik',
 'gomory_hu_tree',
 'google_matrix',
 'gpickle',
 'graph',
 'graph6',
 'graph_atlas',
 'graph_atlas_g',
 'graph_clique_number',
 'graph_edit_distance',
 'graph_number_of_cliques',
 'graphical',
 'graphmatrix',
 'graphml',
 'graphviews',
 'greedy_color',
 'grid_2d_graph',
 'grid_graph',
 'harmonic',
 'harmonic_centrality',
 'has_bridges',
 'has_path',
 'havel_hakimi_graph',
 'heawood_graph',
 'hexagonal_lattice_graph',
 'hierarchy',
 'hits',
 'hits_alg',
 'hits_numpy',
 'hits_scipy',
 'hoffman_singleton_graph',
 'house_graph',
 'house_x_graph',
 'hub_matrix',
 'hybrid',
 'hypercube_graph',
 'icosahedral_graph',
 'identified_nodes',
 'immediate_dominators',
 'in_degree_centrality',
 'incidence_matrix',
 'induced_subgraph',
 'info',
 'information_centrality',
 'intersection',
 'intersection_all',
 'intersection_array',
 'inverse_line_graph',
 'is_aperiodic',
 'is_arborescence',
 'is_attracting_component',
 'is_biconnected',
 'is_bipartite',
 'is_branching',
 'is_chordal',
 'is_connected',
 'is_digraphical',
 'is_directed',
 'is_directed_acyclic_graph',
 'is_distance_regular',
 'is_dominating_set',
 'is_edge_cover',
 'is_empty',
 'is_eulerian',
 'is_forest',
 'is_frozen',
 'is_graphical',
 'is_isolate',
 'is_isomorphic',
 'is_k_edge_connected',
 'is_kl_connected',
 'is_matching',
 'is_maximal_matching',
 'is_multigraphical',
 'is_negatively_weighted',
 'is_perfect_matching',
 'is_pseudographical',
 'is_semiconnected',
 'is_simple_path',
 'is_strongly_connected',
 'is_strongly_regular',
 'is_tree',
 'is_valid_degree_sequence_erdos_gallai',
 'is_valid_degree_sequence_havel_hakimi',
 'is_valid_joint_degree',
 'is_weakly_connected',
 'is_weighted',
 'isolate',
 'isolates',
 'isomorphism',
 'jaccard_coefficient',
 'jit',
 'jit_data',
 'jit_graph',
 'johnson',
 'join',
 'joint_degree_graph',
 'joint_degree_seq',
 'json_graph',
 'k_components',
 'k_core',
 'k_corona',
 'k_crust',
 'k_edge_augmentation',
 'k_edge_components',
 'k_edge_subgraphs',
 'k_nearest_neighbors',
 'k_random_intersection_graph',
 'k_shell',
 'kamada_kawai_layout',
 'karate_club_graph',
 'katz',
 'katz_centrality',
 'katz_centrality_numpy',
 'kl_connected_subgraph',
 'kosaraju_strongly_connected_components',
 'krackhardt_kite_graph',
 'ladder_graph',
 'laplacian_matrix',
 'laplacian_spectrum',
 'laplacianmatrix',
 'lattice',
 'lattice_reference',
 'layout',
 'leda',
 'lexicographic_product',
 'lexicographical_topological_sort',
 'linalg',
 'line',
 'line_graph',
 'link_analysis',
 'link_prediction',
 'load',
 'load_centrality',
 'local_bridges',
 'local_constraint',
 'local_efficiency',
 'local_reaching_centrality',
 'lollipop_graph',
 'lowest_common_ancestor',
 'lowest_common_ancestors',
 'make_clique_bipartite',
 'make_max_clique_graph',
 'make_small_graph',
 'margulis_gabber_galil_graph',
 'matching',
 'max_flow_min_cost',
 'max_weight_matching',
 'maximal_independent_set',
 'maximal_matching',
 'maximum_branching',
 'maximum_flow',
 'maximum_flow_value',
 'maximum_spanning_arborescence',
 'maximum_spanning_edges',
 'maximum_spanning_tree',
 'min_cost_flow',
 'min_cost_flow_cost',
 'min_edge_cover',
 'minimum_branching',
 'minimum_cut',
 'minimum_cut_value',
 'minimum_cycle_basis',
 'minimum_edge_cut',
 'minimum_node_cut',
 'minimum_spanning_arborescence',
 'minimum_spanning_edges',
 'minimum_spanning_tree',
 'minors',
 'mis',
 'mixing',
 'mixing_dict',
 'mixing_expansion',
 'modularity_matrix',
 'modularity_spectrum',
 'modularitymatrix',
 'moebius_kantor_graph',
 'multi_source_dijkstra',
 'multi_source_dijkstra_path',
 'multi_source_dijkstra_path_length',
 'multidigraph',
 'multigraph',
 'multiline_adjlist',
 'mycielski',
 'mycielski_graph',
 'mycielskian',
 'navigable_small_world_graph',
 'negative_edge_cycle',
 'neighbor_degree',
 'neighbors',
 'network_simplex',
 'networkx',
 'newman_watts_strogatz_graph',
 'node_attribute_xy',
 'node_boundary',
 'node_classification',
 'node_clique_number',
 'node_connected_component',
 'node_connectivity',
 'node_degree_xy',
 'node_disjoint_paths',
 'node_expansion',
 'node_link',
 'node_link_data',
 'node_link_graph',
 'nodes',
 'nodes_with_selfloops',
 'non_edges',
 'non_neighbors',
 'nonisomorphic_trees',
 'normalized_cut_size',
 'normalized_laplacian_matrix',
 'not_implemented_for',
 'null_graph',
 'number_attracting_components',
 'number_connected_components',
 'number_of_cliques',
 'number_of_edges',
 'number_of_isolates',
 'number_of_nodes',
 'number_of_nonisomorphic_trees',
 'number_of_selfloops',
 'number_strongly_connected_components',
 'number_weakly_connected_components',
 'numeric_assortativity_coefficient',
 'numeric_mixing_matrix',
 'nx',
 'nx_agraph',
 'nx_pydot',
 'nx_pylab',
 'nx_shp',
 'nx_yaml',
 'octahedral_graph',
 'omega',
 'operators',
 'optimal_edit_paths',
 'optimize_edit_paths',
 'optimize_graph_edit_distance',
 'ordered',
 'out_degree_centrality',
 'overall_reciprocity',
 'pagerank',
 'pagerank_alg',
 'pagerank_numpy',
 'pagerank_scipy',
 'pairs',
 'pajek',
 'pappus_graph',
 'parse_adjlist',
 'parse_edgelist',
 'parse_gml',
 'parse_graphml',
 'parse_leda',
 'parse_multiline_adjlist',
 'parse_pajek',
 'partial_duplication_graph',
 'path_graph',
 'percolation',
 'percolation_centrality',
 'periphery',
 'petersen_graph',
 'planarity',
 'planted_partition_graph',
 'power',
 'powerlaw_cluster_graph',
 'predecessor',
 'preferential_attachment',
 'prefix_tree',
 'product',
 'project',
 'projected_graph',
 'quotient_graph',
 'ra_index_soundarajan_hopcroft',
 'radius',
 'random_clustered',
 'random_clustered_graph',
 'random_degree_sequence_graph',
 'random_geometric_graph',
 'random_graphs',
 'random_k_out_graph',
 'random_kernel_graph',
 'random_layout',
 'random_lobster',
 'random_partition_graph',
 'random_powerlaw_tree',
 'random_powerlaw_tree_sequence',
 'random_reference',
 'random_regular_graph',
 'random_shell_graph',
 'random_tree',
 'reaching',
 'read_adjlist',
 'read_edgelist',
 'read_gexf',
 'read_gml',
 'read_gpickle',
 'read_graph6',
 'read_graphml',
 'read_leda',
 'read_multiline_adjlist',
 'read_pajek',
 'read_shp',
 'read_sparse6',
 'read_weighted_edgelist',
 'read_yaml',
 'readwrite',
 'reciprocity',
 'reconstruct_path',
 'recursive_simple_cycles',
 'relabel',
 'relabel_gexf_graph',
 'relabel_nodes',
 'relaxed_caveman_graph',
 'release',
 'reportviews',
 'rescale_layout',
 'resource_allocation_index',
 'restricted_view',
 'reverse',
 'reverse_view',
 'rich_club_coefficient',
 'richclub',
 'ring_of_cliques',
 'rooted_product',
 's_metric',
 'scale_free_graph',
 'second_order',
 'second_order_centrality',
 'sedgewick_maze_graph',
 'selfloop_edges',
 'semiconnected',
 'set_edge_attributes',
 'set_node_attributes',
 'shell_layout',
 'shortest_path',
 'shortest_path_length',
 'shortest_paths',
 'shortest_simple_paths',
 'sigma',
 'similarity',
 'simple_cycles',
 'simple_paths',
 'single_source_bellman_ford',
 'single_source_bellman_ford_path',
 'single_source_bellman_ford_path_length',
 'single_source_dijkstra',
 'single_source_dijkstra_path',
 'single_source_dijkstra_path_length',
 'single_source_shortest_path',
 'single_source_shortest_path_length',
 'single_target_shortest_path',
 'single_target_shortest_path_length',
 'small',
 'smallworld',
 'smetric',
 'social',
 'soft_random_geometric_graph',
 'spanner',
 'sparse6',
 'sparsifiers',
 'spectral_graph_forge',
 'spectral_layout',
 'spectral_ordering',
 'spectrum',
 'spring_layout',
 'square_clustering',
 'star_graph',
 'stochastic',
 'stochastic_block_model',
 'stochastic_graph',
 'stoer_wagner',
 'strong_product',
 'strongly_connected',
 'strongly_connected_component_subgraphs',
 'strongly_connected_components',
 'strongly_connected_components_recursive',
 'structuralholes',
 'subgraph',
 'subgraph_alg',
 'subgraph_centrality',
 'subgraph_centrality_exp',
 'swap',
 'symmetric_difference',
 'tensor_product',
 'test',
 'tests',
 'tetrahedral_graph',
 'thresholded_random_geometric_graph',
 'to_dict_of_dicts',
 'to_dict_of_lists',
 'to_directed',
 'to_edgelist',
 'to_graph6_bytes',
 'to_nested_tuple',
 'to_networkx_graph',
 'to_numpy_array',
 'to_numpy_matrix',
 'to_numpy_recarray',
 'to_pandas_adjacency',
 'to_pandas_edgelist',
 'to_prufer_sequence',
 'to_scipy_sparse_matrix',
 'to_sparse6_bytes',
 'to_undirected',
 'topological_sort',
 'tournament',
 'transitive_closure',
 'transitive_reduction',
 'transitivity',
 'traversal',
 'tree',
 'tree_all_pairs_lowest_common_ancestor',
 'tree_data',
 'tree_graph',
 'trees',
 'triad_graph',
 'triadic_census',
 'triads',
 'triangles',
 'triangular_lattice_graph',
 'trivial_graph',
 'truncated_cube_graph',
 'truncated_tetrahedron_graph',
 'turan_graph',
 'tutte_graph',
 'unary',
 'uniform_random_intersection_graph',
 'union',
 'union_all',
 'unweighted',
 'utils',
 'vitality',
 'volume',
 'voronoi',
 'voronoi_cells',
 'watts_strogatz_graph',
 'waxman_graph',
 'weakly_connected',
 'weakly_connected_component_subgraphs',
 'weakly_connected_components',
 'weighted',
 'wheel_graph',
 'wiener',
 'wiener_index',
 'windmill_graph',
 'within_inter_cluster',
 'write_adjlist',
 'write_edgelist',
 'write_gexf',
 'write_gml',
 'write_gpickle',
 'write_graph6',
 'write_graphml',
 'write_graphml_lxml',
 'write_graphml_xml',
 'write_multiline_adjlist',
 'write_pajek',
 'write_shp',
 'write_sparse6',
 'write_weighted_edgelist',
 'write_yaml']
In [ ]:
 
In [ ]:
 
In [ ]: