Graph Bricks

class fugu.bricks.graph_bricks.SimpleGraphTraversal(target_graph, target_node=None, name='SimpleGraphTraversal', store_parent_info=False, output_coding='temporal-L')

Bases: Brick

  • This brick traverses a graph (using breadth first search) given a starting vertex.

  • This brick can also be used to solve single source shortest path using edge delays.

  • Predecessor/parent information is returned through edge references.

Parameters:
  • target_graph – NetworkX.Digraph object representing the graph to be searched

  • target_node – Node in the graph that is the target of the paths

  • name – Name of the brick. * If not specified, a default will be used. Name should be unique.

  • output_coding – Output coding type, default is ‘temporal-L’

build(graph, metadata, control_nodes, input_lists, input_codings)

Build Shortest Path brick.

Parameters:
  • graph – networkx graph to define connections of the computational graph * If the graph has edge weights, this brick will solve the single source shortest paths problem

  • metadata (dict) – dictionary to define the shapes and parameters of the brick

  • control_nodes (dict) –

    dictionary of lists of auxillary networkx nodes. Expected keys:

    ’complete’ - A list of neurons that fire when the brick is done

  • input_lists (list) – list of nodes that will contain input

  • input_coding (list) – list of input coding formats. All coding types supported

Returns:

graph of a computational elements and connections self.metadata: dictionary of output parameters (shape, coding, layers, depth, etc) complete: dictionary of control nodes (‘complete’) output_lists (list): list of output self.output_codings (list): list of coding formats of output

Return type:

graph

class fugu.bricks.graph_bricks.RegisterGraphTraversal(target_graph, target_node=None, name='RegisterGraphTraversal', store_parent_info=False, output_coding='temporal-L')

Bases: CompoundBrick

This brick traverses a graph (using breadth first search) given a starting vertex. This brick can also be used to solve single source shortest path using edge delays. Predecessor/parent information is returned through edge references.

Construtor for this brick. :param + target_graph - NetworkX.Digraph object representing the graph to be searched: :param + target_node - Node in the graph that is the target of the paths: :param + name - Name of the brick.: If not specified, a default will be used. Name should be unique. :param + output_coding - Output coding type: :param default is ‘temporal-L’:

build(graph, metadata, control_nodes, input_lists, input_codings)

Build Shortest Path brick.

Parameters:
  • graph (+ graph - networkx graph to define connections of the computational) – If the graph has edge weights, this brick will solve the single source shortest paths problem

  • brick (+ metadata - dictionary to define the shapes and parameters of the)

  • nodes. (+ control_nodes - dictionary of lists of auxillary networkx) –

    Expected keys:

    ’complete’ - A list of neurons that fire when the brick is done

  • input (+ input_lists - list of nodes that will contain)

  • supported (+ input_coding - list of input coding formats. All coding types)

Returns:

  • graph of a computational elements and connections

  • dictionary of output parameters (shape, coding, layers, depth, etc)

  • dictionary of control nodes (‘complete’)

  • list of output

  • list of coding formats of output

class fugu.bricks.graph_bricks.FlowAugmentingPath(flow_graph, name='FlowAugmentingPath', output_coding='temporal-L')

Bases: Brick

This brick computes flow augmenting path based on (Ali, Kwisthout 2019)

Construtor for this brick. :param + flow_graph - NetworkX.Digraph object representing the flow graph: :param + name - Name of the brick.: If not specified, a default will be used. Name should be unique. :param + output_coding - Output coding type: :param default is ‘temporal-L’:

set_properties(graph, properties)

Returns an updated version of the graph based on the parameter values passed.

build(graph, metadata, control_nodes, input_lists, input_codings)

Build Flow Augmenting Path brick.

Parameters:
  • graph (+ graph - networkx graph to define connections of the computational) – If the graph has edge weights, this brick will solve the single source shortest paths problem

  • brick (+ metadata - dictionary to define the shapes and parameters of the)

  • nodes. (+ control_nodes - dictionary of lists of auxillary networkx) –

    Expected keys:

    ’complete’ - A list of neurons that fire when the brick is done

  • input (+ input_lists - list of nodes that will contain)

  • supported (+ input_coding - list of input coding formats. All coding types)

Returns:

  • graph of a computational elements and connections

  • dictionary of output parameters (shape, coding, layers, depth, etc)

  • dictionary of control nodes (‘complete’)

  • list of output

  • list of coding formats of output