pacman.model.graphs package

Submodules

pacman.model.graphs.abstract_edge module

class pacman.model.graphs.abstract_edge.AbstractEdge[source]

Bases: object

A directed edge in a graph between two vertices

label

The label of the edge

Returns:The label
Return type:str
Raises:None – Raises no known exceptions
post_vertex

The vertex at the end of the edge

Return type:pacman.model.graphs.abstract_vertex.AbstractVertex
pre_vertex

The vertex at the start of the edge

Return type:pacman.model.graphs.abstract_vertex.AbstractVertex
traffic_type

The traffic type of the edge

Return type:py:class:pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType

pacman.model.graphs.abstract_fpga_vertex module

class pacman.model.graphs.abstract_fpga_vertex.AbstractFPGAVertex[source]

Bases: pacman.model.graphs.abstract_virtual_vertex.AbstractVirtualVertex

A vertex connected to an FPGA

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

pacman.model.graphs.abstract_graph module

class pacman.model.graphs.abstract_graph.AbstractGraph[source]

Bases: object

A graph

add_constraint(constraint)[source]

Add a constraint

Parameters:constraint (AbstractConstraint) – The constraint to add
add_constraints(constraints)[source]

Add a list of constraints

Parameters:constraints (list of AbstractConstraint) – The list of constraints to add
add_edge(edge, outgoing_edge_partition_name)[source]

Add an edge to the graph

Parameters:
  • edge (pacman.model.graphs.abstract_edge.AbstractEdge) – The edge to add
  • outgoing_edge_partition_name (str) – The name of the edge partition to add the edge to; each edge partition is the partition of edges that start at the same vertex
Raises:

PacmanInvalidParameterException – If the edge is not of a valid type or if edges have already been added to this partition that start at a different vertex to this one

add_edges(edges, outgoing_edge_partition_name)[source]

Add a collection of edges to the graph

Parameters:
  • edges (an iterable of pacman.model.graphs.abstract_edge.AbstractEdge) – The edges to add
  • outgoing_edge_partition_name (str) – The name of the edge partition to add the edges to; each edge partition is the partition of edges that start at the same vertex
Raises:

PacmanInvalidParameterException – If any edge is not of a valid type or if edges have already been added to this partition that start at a different vertex to this one

add_outgoing_edge_partition(outgoing_edge_partition)[source]

Add an outgoing edge partition to the graph

Parameters:outgoing_edge_partition (pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition) – The outgoing edge partition to add
Raises:PacmanAlreadyExistsException – If a partition already exists with the same pre_vertex and identifier
add_vertex(vertex)[source]

Add a vertex to the graph

Parameters:vertex (pacman.model.graphs.abstract_vertex.AbstractVertex) – The vertex to add
Raises:PacmanInvalidParameterException – If the vertex is not of a valid type
add_vertices(vertices)[source]

Add a collection of vertices to the graph.

Parameters:vertices (an iterable of pacman.model.graphs.abstract_vertex.AbstractVertex) – The vertices to add
Raises:PacmanInvalidParameterException – If any vertex is not of a valid type
constraints

The constraints of the vertex

Return type:iterable of AbstractConstraint
edges

The edges in the graph

Return type:iterable of pacman.model.graphs.abstract_edge.AbstractEdge
get_edges_ending_at_vertex(vertex)[source]

Get all the edges that end at the given vertex

Parameters:vertex (pacman.model.graphs.abstract_vertex.AbstractVertex) – The vertex at which the edges to get end
Return type:iterable of pacman.model.graphs.abstract_edge.AbstractEdge
get_edges_ending_at_vertex_with_partition_name(vertex, partition_name)[source]
Get all the edges that end at the given vertex, and reside in the
correct partition id
Parameters:
Returns:

iterable of pacman.model.graphs.abstract_edge.AbstractEdge

get_edges_starting_at_vertex(vertex)[source]

Get all the edges that start at the given vertex

Parameters:vertex (pacman.model.graphs.abstract_vertex.AbstractVertex) – The vertex at which the edges to get start
Return type:iterable of pacman.model.graphs.abstract_edge.AbstractEdge
get_outgoing_edge_partition_starting_at_vertex(vertex, outgoing_edge_partition_name)[source]

Get the given outgoing edge partition that starts at the given vertex, or None if no such edge partition exists

Parameters:
Return type:

pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition

get_outgoing_edge_partitions_starting_at_vertex(vertex)[source]

Get all the edge partitions that start at the given vertex

Parameters:vertex (pacman.model.graphs.abstract_vertex.AbstractVertex) – The vertex at which the edge partitions to find starts
Return type:iterable of pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
get_outgoing_edge_partitions_with_traffic_type(traffic_type)[source]

Get the outgoing edge partitions with a given traffic type

Parameters:traffic_type (pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType) – The traffic type to look for
label

The label of the item

Returns:The label
Return type:str
Raises:None – Raises no known exceptions
n_outgoing_edge_partitions

The number of outgoing edge partitions in the graph

Return type:int
n_vertices

The number of vertices in the graph

Return type:int
outgoing_edge_partitions

The outgoing edge partitions in the graph

Return type:iterable of pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
vertices

The vertices in the graph

Return type:iterable of pacman.model.graphs.abstract_vertex.AbstractVertex

pacman.model.graphs.abstract_outgoing_edge_partition module

class pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition[source]

Bases: object

A group of edges that start at the same vertex and share the same semantics; used to group edges that can use the same multicast key

add_constraint(constraint)[source]

Add a constraint

Parameters:constraint (AbstractConstraint) – The constraint to add
add_constraints(constraints)[source]

Add a list of constraints

Parameters:constraints (list of AbstractConstraint) – The list of constraints to add
add_edge(edge)[source]

Add an edge to the partition

Parameters:edge (pacman.model.graphs.abstract_edge.AbstractEdge) – the edge to add
Raises:pacman.exceptions.PacmanInvalidParameterException if the starting vertex of the edge does not match that of the edges already in the partition
constraints

The constraints of the vertex

Return type:iterable of AbstractConstraint
edges

The edges in this outgoing edge partition

Return type:iterable of pacman.model.graphs.abstract_edge.AbstractEdge
identifier

The identifier of this outgoing edge partition

Return type:str
label

The label of the item

Returns:The label
Return type:str
Raises:None – Raises no known exceptions
n_edges

The number of edges in the partition

Return type:int
pre_vertex

The vertex at which all edges in this partition start

Return type:pacman.model.graphs.abstract_vertex.AbstractVertex
traffic_type

The traffic type of all the edges in this partition

Return type:pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
traffic_weight

The weight of the traffic in this partition compared to other partitions

Return type:int

pacman.model.graphs.abstract_vertex module

class pacman.model.graphs.abstract_vertex.AbstractVertex[source]

Bases: object

A vertex in a graph

add_constraint(constraint)[source]

Add a constraint

Parameters:constraint (AbstractConstraint) – The constraint to add
add_constraints(constraints)[source]

Add a list of constraints

Parameters:constraints (list of AbstractConstraint) – The list of constraints to add
constraints

The constraints of the vertex

Return type:iterable of AbstractConstraint
label

The label of the vertex

Return type:str

pacman.model.graphs.abstract_virtual_vertex module

class pacman.model.graphs.abstract_virtual_vertex.AbstractVirtualVertex[source]

Bases: pacman.model.graphs.abstract_vertex.AbstractVertex

A vertex which exists outside of the machine

board_address

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

Return type:str
set_virtual_chip_coordinates(virtual_chip_x, virtual_chip_y)[source]

Set the details of the virtual chip that has been added to the machine for this vertex

Parameters:
  • virtual_chip_x – The x-coordinate of the added chip
  • virtual_chip_y – The y-coordinate of the added chip
virtual_chip_x

The x-coordinate of the virtual chip where this vertex is to be placed

Return type:int
virtual_chip_y

The y-coordinate of the virtual chip where this vertex is to be placed

Return type:int

Module contents

class pacman.model.graphs.AbstractEdge[source]

Bases: object

A directed edge in a graph between two vertices

label

The label of the edge

Returns:The label
Return type:str
Raises:None – Raises no known exceptions
post_vertex

The vertex at the end of the edge

Return type:pacman.model.graphs.abstract_vertex.AbstractVertex
pre_vertex

The vertex at the start of the edge

Return type:pacman.model.graphs.abstract_vertex.AbstractVertex
traffic_type

The traffic type of the edge

Return type:py:class:pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
class pacman.model.graphs.AbstractFPGAVertex[source]

Bases: pacman.model.graphs.abstract_virtual_vertex.AbstractVirtualVertex

A vertex connected to an FPGA

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.AbstractGraph[source]

Bases: object

A graph

add_constraint(constraint)[source]

Add a constraint

Parameters:constraint (AbstractConstraint) – The constraint to add
add_constraints(constraints)[source]

Add a list of constraints

Parameters:constraints (list of AbstractConstraint) – The list of constraints to add
add_edge(edge, outgoing_edge_partition_name)[source]

Add an edge to the graph

Parameters:
  • edge (pacman.model.graphs.abstract_edge.AbstractEdge) – The edge to add
  • outgoing_edge_partition_name (str) – The name of the edge partition to add the edge to; each edge partition is the partition of edges that start at the same vertex
Raises:

PacmanInvalidParameterException – If the edge is not of a valid type or if edges have already been added to this partition that start at a different vertex to this one

add_edges(edges, outgoing_edge_partition_name)[source]

Add a collection of edges to the graph

Parameters:
  • edges (an iterable of pacman.model.graphs.abstract_edge.AbstractEdge) – The edges to add
  • outgoing_edge_partition_name (str) – The name of the edge partition to add the edges to; each edge partition is the partition of edges that start at the same vertex
Raises:

PacmanInvalidParameterException – If any edge is not of a valid type or if edges have already been added to this partition that start at a different vertex to this one

add_outgoing_edge_partition(outgoing_edge_partition)[source]

Add an outgoing edge partition to the graph

Parameters:outgoing_edge_partition (pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition) – The outgoing edge partition to add
Raises:PacmanAlreadyExistsException – If a partition already exists with the same pre_vertex and identifier
add_vertex(vertex)[source]

Add a vertex to the graph

Parameters:vertex (pacman.model.graphs.abstract_vertex.AbstractVertex) – The vertex to add
Raises:PacmanInvalidParameterException – If the vertex is not of a valid type
add_vertices(vertices)[source]

Add a collection of vertices to the graph.

Parameters:vertices (an iterable of pacman.model.graphs.abstract_vertex.AbstractVertex) – The vertices to add
Raises:PacmanInvalidParameterException – If any vertex is not of a valid type
constraints

The constraints of the vertex

Return type:iterable of AbstractConstraint
edges

The edges in the graph

Return type:iterable of pacman.model.graphs.abstract_edge.AbstractEdge
get_edges_ending_at_vertex(vertex)[source]

Get all the edges that end at the given vertex

Parameters:vertex (pacman.model.graphs.abstract_vertex.AbstractVertex) – The vertex at which the edges to get end
Return type:iterable of pacman.model.graphs.abstract_edge.AbstractEdge
get_edges_ending_at_vertex_with_partition_name(vertex, partition_name)[source]
Get all the edges that end at the given vertex, and reside in the
correct partition id
Parameters:
Returns:

iterable of pacman.model.graphs.abstract_edge.AbstractEdge

get_edges_starting_at_vertex(vertex)[source]

Get all the edges that start at the given vertex

Parameters:vertex (pacman.model.graphs.abstract_vertex.AbstractVertex) – The vertex at which the edges to get start
Return type:iterable of pacman.model.graphs.abstract_edge.AbstractEdge
get_outgoing_edge_partition_starting_at_vertex(vertex, outgoing_edge_partition_name)[source]

Get the given outgoing edge partition that starts at the given vertex, or None if no such edge partition exists

Parameters:
Return type:

pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition

get_outgoing_edge_partitions_starting_at_vertex(vertex)[source]

Get all the edge partitions that start at the given vertex

Parameters:vertex (pacman.model.graphs.abstract_vertex.AbstractVertex) – The vertex at which the edge partitions to find starts
Return type:iterable of pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
get_outgoing_edge_partitions_with_traffic_type(traffic_type)[source]

Get the outgoing edge partitions with a given traffic type

Parameters:traffic_type (pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType) – The traffic type to look for
label

The label of the item

Returns:The label
Return type:str
Raises:None – Raises no known exceptions
n_outgoing_edge_partitions

The number of outgoing edge partitions in the graph

Return type:int
n_vertices

The number of vertices in the graph

Return type:int
outgoing_edge_partitions

The outgoing edge partitions in the graph

Return type:iterable of pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
vertices

The vertices in the graph

Return type:iterable of pacman.model.graphs.abstract_vertex.AbstractVertex
class pacman.model.graphs.AbstractOutgoingEdgePartition[source]

Bases: object

A group of edges that start at the same vertex and share the same semantics; used to group edges that can use the same multicast key

add_constraint(constraint)[source]

Add a constraint

Parameters:constraint (AbstractConstraint) – The constraint to add
add_constraints(constraints)[source]

Add a list of constraints

Parameters:constraints (list of AbstractConstraint) – The list of constraints to add
add_edge(edge)[source]

Add an edge to the partition

Parameters:edge (pacman.model.graphs.abstract_edge.AbstractEdge) – the edge to add
Raises:pacman.exceptions.PacmanInvalidParameterException if the starting vertex of the edge does not match that of the edges already in the partition
constraints

The constraints of the vertex

Return type:iterable of AbstractConstraint
edges

The edges in this outgoing edge partition

Return type:iterable of pacman.model.graphs.abstract_edge.AbstractEdge
identifier

The identifier of this outgoing edge partition

Return type:str
label

The label of the item

Returns:The label
Return type:str
Raises:None – Raises no known exceptions
n_edges

The number of edges in the partition

Return type:int
pre_vertex

The vertex at which all edges in this partition start

Return type:pacman.model.graphs.abstract_vertex.AbstractVertex
traffic_type

The traffic type of all the edges in this partition

Return type:pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
traffic_weight

The weight of the traffic in this partition compared to other partitions

Return type:int
class pacman.model.graphs.AbstractSpiNNakerLinkVertex[source]

Bases: pacman.model.graphs.abstract_virtual_vertex.AbstractVirtualVertex

A vertex connected to a SpiNNaker Link

The SpiNNaker Link that the vertex is connected to

class pacman.model.graphs.AbstractVertex[source]

Bases: object

A vertex in a graph

add_constraint(constraint)[source]

Add a constraint

Parameters:constraint (AbstractConstraint) – The constraint to add
add_constraints(constraints)[source]

Add a list of constraints

Parameters:constraints (list of AbstractConstraint) – The list of constraints to add
constraints

The constraints of the vertex

Return type:iterable of AbstractConstraint
label

The label of the vertex

Return type:str
class pacman.model.graphs.AbstractVirtualVertex[source]

Bases: pacman.model.graphs.abstract_vertex.AbstractVertex

A vertex which exists outside of the machine

board_address

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

Return type:str
set_virtual_chip_coordinates(virtual_chip_x, virtual_chip_y)[source]

Set the details of the virtual chip that has been added to the machine for this vertex

Parameters:
  • virtual_chip_x – The x-coordinate of the added chip
  • virtual_chip_y – The y-coordinate of the added chip
virtual_chip_x

The x-coordinate of the virtual chip where this vertex is to be placed

Return type:int
virtual_chip_y

The y-coordinate of the virtual chip where this vertex is to be placed

Return type:int