nx_parallel.interface#

Classes#

ParallelGraph

A wrapper class for networkx.Graph, networkx.DiGraph, networkx.MultiGraph,

BackendInterface

BackendInterface class for parallel algorithms.

Module Contents#

class nx_parallel.interface.ParallelGraph(graph_object=None)[source]#

A wrapper class for networkx.Graph, networkx.DiGraph, networkx.MultiGraph, and networkx.MultiDiGraph.

is_multigraph()[source]#
is_directed()[source]#
class nx_parallel.interface.BackendInterface[source]#

BackendInterface class for parallel algorithms.

static convert_from_nx(graph, *args, **kwargs)[source]#

Convert a networkx.Graph, networkx.DiGraph, networkx.MultiGraph, or networkx.MultiDiGraph to a ParallelGraph.

static convert_to_nx(result, *, name=None)[source]#

Convert a ParallelGraph to a networkx.Graph, networkx.DiGraph, networkx.MultiGraph, or networkx.MultiDiGraph.

classmethod should_run(name, args, kwargs)[source]#

Determine whether this backend should run the specified algorithm with the given arguments.

Parameters#

clstype

BackendInterface class

namestr

Name of the target algorithm

argstuple

Positional arguments passed to the algorithm’s should_run.

kwargsdict

Keyword arguments passed to the algorithm’s should_run.

Returns#

bool or str

If the algorithm should run, returns True. Otherwise, returns a string explaining why parallel execution is skipped.

static on_start_tests(items)[source]#

Modify pytest items after tests have been collected.

This is called during pytest_collection_modifyitems phase. Mark tests that have different valid behavior in parallel backend.