Artificial Intelligence, Data Science, Machine Learning, Programming, Technology.
and edges (say flight route) import networkx as nx #undirected graph (edges don't have a direction) G = nx.Graph() #directed graph (edges have direction) G = nx.DiGraph() city_graph = [('Chennai', 'Delhi'), ('Mumbai', 'Chennai'), ('Delhi', 'Kolkata'), ('Delhi', 'Bangalore'), ('Chennai',