Executor

executor

This file is used to define the executor of subgraph detection process

grow

This file implement the core grow logic

Executor

class SubgraphDetection.Executor.executor.Executor(graph)[source]
__init__(graph)[source]

init a subgraph detect executor :param graph: The whole graph which executor working on

Parameters

graph (Union[SubgraphDetection.DataStructure.SimpleMindsporeGraph.smsgraph.SMSGraph, mindinsight.datavisual.data_transform.graph.msgraph.MSGraph]) –

__weakref__

list of weak references to the object (if defined)

check_subgraph()[source]

Check if there are any sub-subgraph in self._commit_subgraph and delete the match. Run after an epoch is finished.

Notes

Penalty terms are imposed on sub-sub-graph in thresholds to avoid multiple level subgraphs

Returns

None

commit_core(core)[source]

Let subgraph core commit itself to subgraph.

Parameters

core (SubgraphDetection.DataStructure.Subgraph.subgraph_core.SubgraphCore) – subgraph core which is finish growing

Returns

None

next_epoch()[source]

Let all cores in core_deque grow to next epoch and update the core_deque

register_core(core_ids)[source]

Register the cores to avoid extra computation.

Notes

If a core is registered, means it is already been computed or added to next epoch core deque. This function should be exclusive, make sure to acquire the lock before.

Parameters

core_ids (Tuple[int, ..]) – Tuple of core ids that should be checked

Returns

Tuple of bool, correspond to the input core_ids tuple.

Return type

Tuple[bool, ..]

run()[source]

Run until every subgraph core is committed or destroyed

Returns

Deque of subgraph, all the detected subgraphs

Return type

Deque[SubgraphDetection.DataStructure.Subgraph.subgraph.Subgraph]

core_grow

SubgraphDetection.Executor.grow.core_grow(executor, core)[source]

Make one core grow to next epoch

Parameters
  • executor – The Executor object, Locks and some other apis need to be invoked from it

  • core (SubgraphDetection.DataStructure.Subgraph.subgraph_core.SubgraphCore) – The core waiting for grow

Returns

A tuple of new cores, grow from the input one

Return type

collections.deque