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

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
主站蜘蛛池模板: 竹山县| 洛宁县| 图片| 库伦旗| 大港区| 门头沟区| 图木舒克市| 柯坪县| 富蕴县| 龙山县| 礼泉县| 安远县| 原平市| 新邵县| 漠河县| 商水县| 百色市| 宝清县| 富宁县| 景宁| 嘉祥县| 林西县| 文化| 宿松县| 塘沽区| 东城区| 岑溪市| 达尔| 呼伦贝尔市| 永宁县| 内黄县| 荣昌县| 界首市| 凯里市| 综艺| 康乐县| 衡水市| 尼玛县| 岳阳县| 类乌齐县| 鹤峰县|