pacman.model.graphs package¶
Subpackages¶
- pacman.model.graphs.application package
- Submodules
- pacman.model.graphs.application.application_edge module
- pacman.model.graphs.application.application_fpga_vertex module
- pacman.model.graphs.application.application_graph module
- pacman.model.graphs.application.application_outgoing_edge_partition module
- pacman.model.graphs.application.application_spinnaker_link_vertex module
- pacman.model.graphs.application.application_vertex module
- Module contents
- pacman.model.graphs.common package
- pacman.model.graphs.impl package
- pacman.model.graphs.machine package
- Submodules
- pacman.model.graphs.machine.machine_edge module
- pacman.model.graphs.machine.machine_fpga_vertex module
- pacman.model.graphs.machine.machine_graph module
- pacman.model.graphs.machine.machine_outgoing_edge_partition module
- pacman.model.graphs.machine.machine_spinnaker_link_vertex module
- pacman.model.graphs.machine.machine_vertex module
- pacman.model.graphs.machine.simple_machine_vertex module
- Module contents
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: pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
-
pacman.model.graphs.abstract_fpga module¶
-
class
pacman.model.graphs.abstract_fpga.
AbstractFPGA
[source]¶ Bases:
pacman.model.graphs.abstract_virtual.AbstractVirtual
An Object (most likely a vertex) connected to an FPGA.
Note: It is expected that everything that is an instance of AbstractFPGA is also an instance of AbstractVertex, This is not enforced to avoid diamond inheritance.
-
fpga_id
¶ The ID of the FPGA to which the vertex is connected.
Return type: int
-
fpga_link_id
¶ 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 to the graph.
Parameters: constraint ( AbstractConstraint
) – The constraint to add
-
add_constraints
(constraints)[source]¶ Add a list of constraints to the graph.
Parameters: constraints (list( 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.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
- edge (
-
add_edges
(edges, outgoing_edge_partition_name)[source]¶ Add a collection of edges to the graph.
Parameters: - edges (iterable(
pacman.model.graphs.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
- edges (iterable(
-
add_outgoing_edge_partition
(outgoing_edge_partition)[source]¶ Add an outgoing edge partition to the graph.
Parameters: outgoing_edge_partition ( pacman.model.graphs.AbstractOutgoingEdgePartition
) – The outgoing edge partition to addRaises: 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.AbstractVertex
) – The vertex to addRaises: - PacmanInvalidParameterException – If the vertex is not of a valid type
- PacmanConfigurationException – If there is an attempt to add the same vertex more than once
-
add_vertices
(vertices)[source]¶ Add a collection of vertices to the graph.
Parameters: vertices (iterable(
pacman.model.graphs.AbstractVertex
)) – The vertices to addRaises: - PacmanInvalidParameterException – If any vertex is not of a valid type
- PacmanConfigurationException – If there is an attempt to add the same vertex more than once
-
constraints
¶ The constraints of the graph.
Return type: iterable( AbstractConstraint
)
-
edges
¶ The edges in the graph
Return type: iterable( pacman.model.graphs.AbstractEdge
)
-
get_edges_ending_at_vertex
(vertex)[source]¶ Get all the edges that end at the given vertex.
Parameters: vertex ( pacman.model.graphs.AbstractVertex
) – The vertex at which the edges to get endReturn type: iterable( pacman.model.graphs.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: - vertex (
pacman.model.graphs.AbstractVertex
) – The vertex at which the edges to get end - partition_name (str) – the label for the partition
Returns: iterable(
pacman.model.graphs.AbstractEdge
)- vertex (
-
get_edges_starting_at_vertex
(vertex)[source]¶ Get all the edges that start at the given vertex.
Parameters: vertex ( pacman.model.graphs.AbstractVertex
) – The vertex at which the edges to get startReturn type: iterable( pacman.model.graphs.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: - vertex (
pacman.model.graphs.AbstractVertex
) – The vertex at the start of the edges in the partition - outgoing_edge_partition_name (str) – The name of the edge partition
Return type: - vertex (
-
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.AbstractVertex
) – The vertex at which the edge partitions to find startsReturn type: iterable( pacman.model.graphs.AbstractOutgoingEdgePartition
)
-
get_outgoing_partition_for_edge
(edge)[source]¶ gets the outgoing partition this edge is associated with.
Parameters: edge ( pacman.model.graphs.AbstractEdge
) – the edge to find associated partitionReturns: the outgoing partition Return type: pacman.model.graphs.AbstractOutgoingEdgePartition
-
label
¶ The label of the graph.
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( pacman.model.graphs.AbstractOutgoingEdgePartition
)
-
vertices
¶ The vertices in the graph.
Return type: iterable( pacman.model.graphs.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 to the outgoing edge partition.
Parameters: constraint ( AbstractConstraint
) – The constraint to add
-
add_constraints
(constraints)[source]¶ Add a list of constraints to the outgoing edge partition.
Parameters: constraints (iterable( AbstractConstraint
)) – The list of constraints to add
-
add_edge
(edge)[source]¶ Add an edge to the outgoing edge partition.
Parameters: edge ( pacman.model.graphs.AbstractEdge
) – the edge to addRaises: 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 outgoing edge partition.
Return type: iterable( AbstractConstraint
)
-
edges
¶ The edges in this outgoing edge partition.
Return type: iterable( pacman.model.graphs.AbstractEdge
)
-
identifier
¶ The identifier of this outgoing edge partition.
Return type: str
-
label
¶ The label of the outgoing edge partition.
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
n_edges
¶ The number of edges in the outgoing edge partition.
Return type: int
-
pre_vertex
¶ The vertex at which all edges in this outgoing edge partition start.
Return type: pacman.model.graphs.AbstractVertex
-
traffic_type
¶ The traffic type of all the edges in this outgoing edge partition.
Return type: pacman.model.graphs.common.EdgeTrafficType
-
traffic_weight
¶ The weight of the traffic in this outgoing edge partition compared to other partitions.
Return type: int
-
pacman.model.graphs.abstract_spinnaker_link module¶
-
class
pacman.model.graphs.abstract_spinnaker_link.
AbstractSpiNNakerLink
[source]¶ Bases:
pacman.model.graphs.abstract_virtual.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.
-
spinnaker_link_id
¶ The SpiNNaker Link that the vertex is connected to.
-
pacman.model.graphs.abstract_vertex module¶
-
class
pacman.model.graphs.abstract_vertex.
AbstractVertex
(label=None, constraints=None)[source]¶ Bases:
pacman.model.graphs.common.constrained_object.ConstrainedObject
A vertex in a graph.
Parameters: - label (str) – The optional name of the vertex
- constraints (iterable(
pacman.model.constraints.AbstractConstraint
)) – The optional initial constraints of the vertex
Raises: pacman.exceptions.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
¶ Returns the current label to the vertex.
This label could change when the vertex is added to the graph. :return: The label :rtype: str
-
set_label
(label)[source]¶ Changes the label for a vertex NOT yet ADDED to a graph
Parameters: label – 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
pacman.model.graphs.abstract_virtual module¶
-
class
pacman.model.graphs.abstract_virtual.
AbstractVirtual
[source]¶ Bases:
object
An Object (most likely a vertex) which exists outside of the machine, allowing a graph to formally participate in I/O.
Note: It is expected that everything that is an instance of AbstractVirtual is also an instance of AbstractVertex, This is not enforced to avoid diamond inheritance.
-
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: pacman.model.graphs.common.edge_traffic_type.EdgeTrafficType
-
-
class
pacman.model.graphs.
AbstractFPGA
[source]¶ Bases:
pacman.model.graphs.abstract_virtual.AbstractVirtual
An Object (most likely a vertex) connected to an FPGA.
Note: It is expected that everything that is an instance of AbstractFPGA is also an instance of AbstractVertex, This is not enforced to avoid diamond inheritance.
-
fpga_id
¶ The ID of the FPGA to which the vertex is connected.
Return type: int
-
fpga_link_id
¶ 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 to the graph.
Parameters: constraint ( AbstractConstraint
) – The constraint to add
-
add_constraints
(constraints)[source]¶ Add a list of constraints to the graph.
Parameters: constraints (list( 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.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
- edge (
-
add_edges
(edges, outgoing_edge_partition_name)[source]¶ Add a collection of edges to the graph.
Parameters: - edges (iterable(
pacman.model.graphs.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
- edges (iterable(
-
add_outgoing_edge_partition
(outgoing_edge_partition)[source]¶ Add an outgoing edge partition to the graph.
Parameters: outgoing_edge_partition ( pacman.model.graphs.AbstractOutgoingEdgePartition
) – The outgoing edge partition to addRaises: 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.AbstractVertex
) – The vertex to addRaises: - PacmanInvalidParameterException – If the vertex is not of a valid type
- PacmanConfigurationException – If there is an attempt to add the same vertex more than once
-
add_vertices
(vertices)[source]¶ Add a collection of vertices to the graph.
Parameters: vertices (iterable(
pacman.model.graphs.AbstractVertex
)) – The vertices to addRaises: - PacmanInvalidParameterException – If any vertex is not of a valid type
- PacmanConfigurationException – If there is an attempt to add the same vertex more than once
-
constraints
¶ The constraints of the graph.
Return type: iterable( AbstractConstraint
)
-
edges
¶ The edges in the graph
Return type: iterable( pacman.model.graphs.AbstractEdge
)
-
get_edges_ending_at_vertex
(vertex)[source]¶ Get all the edges that end at the given vertex.
Parameters: vertex ( pacman.model.graphs.AbstractVertex
) – The vertex at which the edges to get endReturn type: iterable( pacman.model.graphs.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: - vertex (
pacman.model.graphs.AbstractVertex
) – The vertex at which the edges to get end - partition_name (str) – the label for the partition
Returns: iterable(
pacman.model.graphs.AbstractEdge
)- vertex (
-
get_edges_starting_at_vertex
(vertex)[source]¶ Get all the edges that start at the given vertex.
Parameters: vertex ( pacman.model.graphs.AbstractVertex
) – The vertex at which the edges to get startReturn type: iterable( pacman.model.graphs.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: - vertex (
pacman.model.graphs.AbstractVertex
) – The vertex at the start of the edges in the partition - outgoing_edge_partition_name (str) – The name of the edge partition
Return type: - vertex (
-
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.AbstractVertex
) – The vertex at which the edge partitions to find startsReturn type: iterable( pacman.model.graphs.AbstractOutgoingEdgePartition
)
-
get_outgoing_partition_for_edge
(edge)[source]¶ gets the outgoing partition this edge is associated with.
Parameters: edge ( pacman.model.graphs.AbstractEdge
) – the edge to find associated partitionReturns: the outgoing partition Return type: pacman.model.graphs.AbstractOutgoingEdgePartition
-
label
¶ The label of the graph.
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( pacman.model.graphs.AbstractOutgoingEdgePartition
)
-
vertices
¶ The vertices in the graph.
Return type: iterable( pacman.model.graphs.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 to the outgoing edge partition.
Parameters: constraint ( AbstractConstraint
) – The constraint to add
-
add_constraints
(constraints)[source]¶ Add a list of constraints to the outgoing edge partition.
Parameters: constraints (iterable( AbstractConstraint
)) – The list of constraints to add
-
add_edge
(edge)[source]¶ Add an edge to the outgoing edge partition.
Parameters: edge ( pacman.model.graphs.AbstractEdge
) – the edge to addRaises: 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 outgoing edge partition.
Return type: iterable( AbstractConstraint
)
-
edges
¶ The edges in this outgoing edge partition.
Return type: iterable( pacman.model.graphs.AbstractEdge
)
-
identifier
¶ The identifier of this outgoing edge partition.
Return type: str
-
label
¶ The label of the outgoing edge partition.
Returns: The label Return type: str Raises: None – Raises no known exceptions
-
n_edges
¶ The number of edges in the outgoing edge partition.
Return type: int
-
pre_vertex
¶ The vertex at which all edges in this outgoing edge partition start.
Return type: pacman.model.graphs.AbstractVertex
-
traffic_type
¶ The traffic type of all the edges in this outgoing edge partition.
Return type: pacman.model.graphs.common.EdgeTrafficType
-
traffic_weight
¶ The weight of the traffic in this outgoing edge partition compared to other partitions.
Return type: int
-
-
class
pacman.model.graphs.
AbstractSpiNNakerLink
[source]¶ Bases:
pacman.model.graphs.abstract_virtual.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.
-
spinnaker_link_id
¶ The SpiNNaker Link that the vertex is connected to.
-
-
class
pacman.model.graphs.
AbstractVertex
(label=None, constraints=None)[source]¶ Bases:
pacman.model.graphs.common.constrained_object.ConstrainedObject
A vertex in a graph.
Parameters: - label (str) – The optional name of the vertex
- constraints (iterable(
pacman.model.constraints.AbstractConstraint
)) – The optional initial constraints of the vertex
Raises: pacman.exceptions.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
¶ Returns the current label to the vertex.
This label could change when the vertex is added to the graph. :return: The label :rtype: str
-
set_label
(label)[source]¶ Changes the label for a vertex NOT yet ADDED to a graph
Parameters: label – 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
[source]¶ Bases:
object
An Object (most likely a vertex) which exists outside of the machine, allowing a graph to formally participate in I/O.
Note: It is expected that everything that is an instance of AbstractVirtual is also an instance of AbstractVertex, This is not enforced to avoid diamond inheritance.
-
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
-