Networkx使用指南(初识)
- 0. 版本信息
- 1. Creating a graph 创建图形
- 2. Nodes 结点
- 3. Edges 边缘
- 4. Examining elements of a graph检查图的元素
- 5. Removing elements from a graph 从图形中删除元素
- 6. Using the graph constructors 使用图形构造函数
- 7. What to use as nodes and edges用作节点和边的内容
- 8. Accessing edges and neighbors访问边缘和邻居
- 9. Adding attributes to graphs, nodes, and edges向图形、节点和边添加属性
- 10. Directed graphs有向图
- 11. Multigraphs多重图
- 12. Graph generators and graph operations图形生成器和图形操作
-
- 12.1. Applying classic graph operations应用经典的图形操作
- 12.2 Using a call to one of the classic small graphs使用对经典小图之一的调用
- 12.3. Using a (constructive) generator for a classic graph使用经典图形的(构造性)生成器
- 12.4. Using a stochastic graph generator使用随机图形生成器
- 12.5. Reading a graph stored in a file using common graph formats使用常用图形格式读取存储在文件中的图形
- 13. Analyzing graphs分析图形
- 14. Drawing graphs图形绘制
0. 版本信息
使用networkx会和模块的关联版本相关,这里使用的是python3.8,matplotlib版本:3.4.1,networkx版本:2.4
1. Creating a graph 创建图形
Create an empty graph with no nodes and no edges.
创建一个没有节点和边的空图形。
By definition, a Graph
is a collection of nodes (vertices) along with identified pairs of nodes (called edges, links, etc). In NetworkX, nodes can be any hashable object e.g., a text string, an image, an XML object, another Graph, a customized node object, etc.