當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python NetworkX dominance_frontiers用法及代碼示例

本文簡要介紹 networkx.algorithms.dominance.dominance_frontiers 的用法。

用法:

dominance_frontiers(G, start)

返回有向圖所有節點的優勢邊界。

參數

GDiGraph 或 MultiDiGraph

要計算支配地位的圖表。

start節點

優勢計算的起始節點。

返回

df由節點鍵入的字典

一個字典,包含從 start 可到達的每個節點的優勢邊界作為列表。

拋出

NetworkXNotImplemented

如果 G 是無向的。

NetworkXError

如果 start 不在 G 中。

參考

1

K. D. Cooper, T. J. Harvey, and K. Kennedy. A simple, fast dominance algorithm. Software Practice & Experience, 4:110, 2001.

例子

>>> G = nx.DiGraph([(1, 2), (1, 3), (2, 5), (3, 4), (4, 5)])
>>> sorted((u, sorted(df)) for u, df in nx.dominance_frontiers(G, 1).items())
[(1, []), (2, [5]), (3, [5]), (4, [5]), (5, [])]

相關用法


注:本文由純淨天空篩選整理自networkx.org大神的英文原創作品 networkx.algorithms.dominance.dominance_frontiers。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。