not_implemented_for#
- not_implemented_for(*graph_types)[source]#
标记算法为未实现的装饰器
- 参数:
- graph_types字符串容器
条目必须是“directed”、“undirected”、“multigraph”或“graph”之一。
- 返回:
- _require函数
被装饰的函数。
- 抛出:
- NetworkXNotImplemented
- 如果任何包无法导入
注意
多个类型通过逻辑“与”连接。对于逻辑“或”,请使用多个 @not_implemented_for() 行。
示例
像这样装饰函数
@not_implemented_for("directed") def sp_function(G): pass # rule out MultiDiGraph @not_implemented_for("directed", "multigraph") def sp_np_function(G): pass # rule out all except DiGraph @not_implemented_for("undirected") @not_implemented_for("multigraph") def sp_np_function(G): pass