pacman.model.graphs package

Module contents

class pacman.model.graphs.AbstractEdge

Bases: object

A directed edge in a graph between two vertices.

label

The label of the edge

Return type:str
post_vertex

The vertex at the end of the edge

Return type:AbstractVertex
pre_vertex

The vertex at the start of the edge

Return type:AbstractVertex
class pacman.model.graphs.AbstractEdgePartition(identifier, allowed_edge_types)

Bases: object

A collection of edges which start at a single vertex which have the same semantics and so can share a single key or block of SDRAM (depending on edge type).

Parameters:
  • identifier (str) – The identifier of the partition
  • allowed_edge_types (type or tuple(type, ..)) – The types of edges allowed
  • label (str) – An optional label of the partition
add_edge(edge)[source]

Add an edge to the edge partition.

Parameters:edge (AbstractEdge) – the edge to add
Raises:PacmanInvalidParameterException – If the edge does not belong in this edge partition
edges

The edges in this edge partition.

Note

The order in which the edges are added is preserved for when they are requested later. If not, please talk to the software team.

Return type:iterable(AbstractEdge)
identifier

The identifier of this edge partition.

Return type:str
n_edges

The number of edges in the edge partition.

Return type:int
pre_vertices

Provides the vertices associated with this partition

Note

Most edge partitions will be AbstractSingleSourcePartition and therefore provide the pre_vertex method.

Return type:iter(AbstractVertex)
class pacman.model.graphs.AbstractFPGA

Bases: pacman.model.graphs.AbstractVirtual

A vertex connected to an FPGA.

Note

Everything that is an instance of AbstractFPGA is also an instance of AbstractVertex.

fpga_id

The ID of the FPGA to which the vertex is connected.

Return type:int

The link of the FPGA to which the vertex is connected.

Return type:int
class pacman.model.graphs.AbstractMultiplePartition(pre_vertices, identifier, allowed_edge_types)

Bases: pacman.model.graphs.AbstractEdgePartition

An edge partition that has multiple source vertices.

add_edge(edge)[source]

Add an edge to the edge partition.

Parameters:edge (AbstractEdge) – the edge to add
Raises:PacmanInvalidParameterException – If the edge does not belong in this edge partition
pre_vertices

Provides the vertices associated with this partition

Note

Most edge partitions will be AbstractSingleSourcePartition and therefore provide the pre_vertex method.

Return type:iter(AbstractVertex)
class pacman.model.graphs.AbstractSingleSourcePartition(pre_vertex, identifier, allowed_edge_types)

Bases: pacman.model.graphs.AbstractEdgePartition

An edge partition that has a single source vertex.

add_edge(edge)[source]

Add an edge to the edge partition.

Parameters:edge (AbstractEdge) – the edge to add
Raises:PacmanInvalidParameterException – If the edge does not belong in this edge partition
pre_vertex

The vertex at which all edges in this outgoing edge partition start.

Return type:AbstractVertex
pre_vertices

Provides the vertices associated with this partition

Note

Most edge partitions will be AbstractSingleSourcePartition and therefore provide the pre_vertex method.

Return type:iter(AbstractVertex)

Bases: pacman.model.graphs.AbstractVirtual

An Object (most likely a vertex) connected to a SpiNNaker Link.

Note

It is expected that everything that is an instance of AbstractSpiNNakerLink is also an instance of AbstractVertex. This is not enforced to avoid diamond inheritance.

The SpiNNaker Link that the vertex is connected to.

Return type:int
class pacman.model.graphs.AbstractSupportsSDRAMEdges

Bases: object

Marks a machine vertex that can have SDRAM edges attached to it.

sdram_requirement(sdram_machine_edge)[source]

Asks a machine vertex for the sdram requirement it needs.

Parameters:sdram_machine_edge – The SDRAM edge in question
Returns:the size in bytes this vertex needs for the SDRAM edge
Return type:int (most likely a multiple of 4)
class pacman.model.graphs.AbstractVertex(label=None, constraints=None)

Bases: pacman.model.graphs.common.constrained_object.ConstrainedObject

A vertex in a graph.

Parameters:
  • label (str) – The optional name of the vertex
  • constraints (iterable(AbstractConstraint)) – The optional initial constraints of the vertex
Raises:

PacmanInvalidParameterException – If one of the constraints is not valid

addedToGraph()[source]

Records that the vertex has been added to a graph

Raises:PacmanConfigurationException – If there is an attempt to add the same vertex more than once
label

The current label to the vertex.

This label could change when the vertex is added to the graph.

Return type:str
set_label(label)[source]

Changes the label for a vertex not yet added to a graph.

Parameters:label (str) – new value for the label
Raises:PacmanConfigurationException – If there is an attempt to change the label once the vertex has been added to a graph
class pacman.model.graphs.AbstractVirtual

Bases: object

A vertex which exists outside of the machine, allowing a graph to formally participate in I/O.

Note

Everything that is an instance of AbstractVirtual is also an instance of AbstractVertex.

board_address

The IP address of the board to which the device is connected, or None for the boot board.

Return type:str