pacman.model.graphs.impl package¶
Submodules¶
pacman.model.graphs.impl.graph module¶
-
class
pacman.model.graphs.impl.graph.
Graph
(allowed_vertex_types, allowed_edge_types, allowed_partition_types, label)[source]¶ Bases:
pacman.model.graphs.common.constrained_object.ConstrainedObject
,pacman.model.graphs.abstract_graph.AbstractGraph
A graph implementation that specifies the allowed types of the vertices and edges.
Parameters: - allowed_vertex_types – A single or tuple of types of vertex to be allowed in the graph
- allowed_edge_types – A single or tuple of types of edges to be allowed in the graph
- allowed_partition_types – A single or tuple of types of partitions to be allowed in the graph
- label – The label on the graph, or None
-
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_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
-
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.impl.outgoing_edge_partition module¶
-
class
pacman.model.graphs.impl.outgoing_edge_partition.
OutgoingEdgePartition
(identifier, allowed_edge_types, constraints=None, label=None, traffic_weight=1)[source]¶ Bases:
pacman.model.graphs.common.constrained_object.ConstrainedObject
,pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
A collection of edges which start at a single vertex which have the same semantics and so can share a single key.
Parameters: - identifier – The identifier of the partition
- allowed_edge_types – The types of edges allowed
- constraints – Any initial constraints
- label – An optional label of the partition
- traffic_weight – The weight of traffic going down this partition
-
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
-
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
Module contents¶
-
class
pacman.model.graphs.impl.
Graph
(allowed_vertex_types, allowed_edge_types, allowed_partition_types, label)[source]¶ Bases:
pacman.model.graphs.common.constrained_object.ConstrainedObject
,pacman.model.graphs.abstract_graph.AbstractGraph
A graph implementation that specifies the allowed types of the vertices and edges.
Parameters: - allowed_vertex_types – A single or tuple of types of vertex to be allowed in the graph
- allowed_edge_types – A single or tuple of types of edges to be allowed in the graph
- allowed_partition_types – A single or tuple of types of partitions to be allowed in the graph
- label – The label on the graph, or None
-
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_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
-
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.impl.
OutgoingEdgePartition
(identifier, allowed_edge_types, constraints=None, label=None, traffic_weight=1)[source]¶ Bases:
pacman.model.graphs.common.constrained_object.ConstrainedObject
,pacman.model.graphs.abstract_outgoing_edge_partition.AbstractOutgoingEdgePartition
A collection of edges which start at a single vertex which have the same semantics and so can share a single key.
Parameters: - identifier – The identifier of the partition
- allowed_edge_types – The types of edges allowed
- constraints – Any initial constraints
- label – An optional label of the partition
- traffic_weight – The weight of traffic going down this partition
-
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
-
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