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

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
主站蜘蛛池模板: 垦利县| 徐水县| 民权县| 泰兴市| 滁州市| 靖安县| 封丘县| 尉氏县| 安化县| 宁乡县| 望谟县| 铅山县| 象山县| 武义县| 阿图什市| 双城市| 东丽区| 广河县| 会泽县| 古交市| 高唐县| 栾城县| 卢湾区| 连南| 临安市| 济南市| 开鲁县| 察雅县| 丰台区| 丽水市| 治县。| 西盟| 湖口县| 新密市| 石家庄市| 循化| 寿宁县| 崇州市| 怀安县| 灵丘县| 和硕县|