not_implemented_for

not_implemented_for(*graph_types)[source]

Decorator to mark algorithms as not implemented

Parameters
graph_typescontainer of strings

Entries must be one of “directed”, “undirected”, “multigraph”, or “graph”.

Returns
_requirefunction

The decorated function.

Raises
NetworkXNotImplemented
If any of the packages cannot be imported

Notes

Multiple types are joined logically with “and”. For “or” use multiple @not_implemented_for() lines.

Examples

Decorate functions like this:

@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