python import networkx as nx graph = nx.Graph() graph.add_nodes_from([1, 2, 3, 4, 5]) graph.add_edges_from([(1, 2), (1, 3), (2, 3), (3, 4), (4, 5), (5, 1)]) degree_distribution = nx.degree_histogram(graph) shortest_path = nx.shortest_path(graph, 1, 5)


上一篇:
下一篇:
切换中文