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

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
主站蜘蛛池模板: 阿图什市| 孝义市| 瓦房店市| 平湖市| 炎陵县| 清镇市| 武宣县| 宜昌市| 邵武市| 东平县| 屏南县| 伊春市| 布尔津县| 梁山县| 和平区| 天峻县| 乐山市| 龙口市| 夏河县| 西乌珠穆沁旗| 西城区| 平顶山市| 虹口区| 江陵县| 师宗县| 时尚| 黄石市| 高州市| 来安县| 邵东县| 大渡口区| 乌拉特中旗| 嵊州市| 林州市| 万山特区| 隆尧县| 外汇| 温泉县| 乌恰县| 甘谷县| 隆化县|