官术网_书友最值得收藏!

Directed networks

Sometimes, it helps to add just a little more detail to a network. The edges we've seen so far don't have any sense of coming from or going to; they are simply connections between two nodes, so they are called symmetric or undirected.

Imagine a network that represents a system of roads (edges) and intersections (nodes). A network with undirected edges would be a good representation, until you came across a one-way street. An undirected edge suggests that you can travel in either direction equally well, while in reality, driving against traffic is likely to be a rather different experience from driving with it.

When direction matters, a network is called directed. In a directed network, each edge has a source node and a target node. Typically, the edge represents a flow of some kind, for example, traffic, from the source to the target. But what if not all connections are one-way? Easy! Two-way connections are made by combining two directed edges going in opposite directions. In directed networks, edges are drawn with arrows pointing toward the target, as shown in the following diagram. In NetworkX, directed networks are represented by the DiGraph class, also described in Chapter 2, Working with Networks in NetworkX:

Example of a directed network
主站蜘蛛池模板: 尚义县| 福建省| 临海市| 泰州市| 蓬莱市| 金堂县| 盐津县| 赤水市| 华容县| 滨州市| 鄢陵县| 邹平县| 怀仁县| 石景山区| 六盘水市| 睢宁县| 汾阳市| 扬州市| 上高县| 霍城县| 新安县| 融水| 巴东县| 东乌珠穆沁旗| 郴州市| 广平县| 镇康县| 东宁县| 阆中市| 永嘉县| 来宾市| 赞皇县| 鄯善县| 上栗县| 龙山县| 内江市| 永德县| 建水县| 吉木萨尔县| 潜江市| 清远市|