Classes¶
Topology¶
-
class
Topology(data=None, name='', **kwargs)[source]¶ Base class for undirected topology
Attributes
nameMethods
add_cycle(nodes, **attr)Add a cycle. add_edge(u, v[, attr_dict])Add an edge between u and v. add_edges_from(ebunch[, attr_dict])Add all the edges in ebunch. add_node(n[, attr_dict])Add a single node n and update node attributes. add_nodes_from(nodes, **attr)Add multiple nodes. add_path(nodes, **attr)Add a path. add_star(nodes, **attr)Add a star. add_weighted_edges_from(ebunch[, weight])Add all the edges in ebunch as weighted edges with specified weights. adjacency_iter()Return an iterator of (node, adjacency dict) tuples for all nodes. adjacency_list()Return an adjacency list representation of the graph. adjlist_dict_factoryalias of dictapplications()Return a dictionary of all applications deployed, keyed by node buffers()Return a dictionary of all buffer sizes, keyed by interface capacities()Return a dictionary of all link capacities, keyed by link clear()Remove all nodes and edges from the graph. copy()Return a copy of the topology. degree([nbunch, weight])Return the degree of a node or nodes. degree_iter([nbunch, weight])Return an iterator for (node, degree). delays()Return a dictionary of all link delays, keyed by link edge_attr_dict_factoryalias of dictedges([nbunch, data, default])Return a list of edges. edges_iter([nbunch, data, default])Return an iterator over the edges. get_edge_data(u, v[, default])Return the attribute dictionary associated with edge (u,v). has_edge(u, v)Return True if the edge (u,v) is in the graph. has_node(n)Return True if the graph contains the node n. is_directed()Return True if graph is directed, False otherwise. is_multigraph()Return True if graph is a multigraph, False otherwise. nbunch_iter([nbunch])Return an iterator of nodes contained in nbunch that are also in the graph. neighbors(n)Return a list of the nodes connected to the node n. neighbors_iter(n)Return an iterator over all neighbors of node n. node_dict_factoryalias of dictnodes([data])Return a list of the nodes in the graph. nodes_iter([data])Return an iterator over the nodes. nodes_with_selfloops()Return a list of nodes with self loops. number_of_edges([u, v])Return the number of edges between two nodes. number_of_nodes()Return the number of nodes in the graph. number_of_selfloops()Return the number of selfloop edges. order()Return the number of nodes in the graph. remove_edge(u, v)Remove the edge between u and v. remove_edges_from(ebunch)Remove all edges specified in ebunch. remove_node(n)Remove node n. remove_nodes_from(nodes)Remove multiple nodes. selfloop_edges([data, default])Return a list of selfloop edges. size([weight])Return the number of edges. stacks()Return a dictionary of all node stacks, keyed by node subgraph(nbunch)Return the subgraph induced on nodes in nbunch. to_directed()Return a directed representation of the topology. to_undirected()Return an undirected copy of the topology. weights()Return a dictionary of all link weights, keyed by link
DirectedTopology¶
-
class
DirectedTopology(data=None, name='', **kwargs)[source]¶ Base class for directed topology
Attributes
nameMethods
add_cycle(nodes, **attr)Add a cycle. add_edge(u, v[, attr_dict])Add an edge between u and v. add_edges_from(ebunch[, attr_dict])Add all the edges in ebunch. add_node(n[, attr_dict])Add a single node n and update node attributes. add_nodes_from(nodes, **attr)Add multiple nodes. add_path(nodes, **attr)Add a path. add_star(nodes, **attr)Add a star. add_weighted_edges_from(ebunch[, weight])Add all the edges in ebunch as weighted edges with specified weights. adjacency_iter()Return an iterator of (node, adjacency dict) tuples for all nodes. adjacency_list()Return an adjacency list representation of the graph. adjlist_dict_factoryalias of dictapplications()Return a dictionary of all applications deployed, keyed by node buffers()Return a dictionary of all buffer sizes, keyed by interface capacities()Return a dictionary of all link capacities, keyed by link clear()Remove all nodes and edges from the graph. copy()Return a copy of the topology. degree([nbunch, weight])Return the degree of a node or nodes. degree_iter([nbunch, weight])Return an iterator for (node, degree). delays()Return a dictionary of all link delays, keyed by link edge_attr_dict_factoryalias of dictedges([nbunch, data, default])Return a list of edges. edges_iter([nbunch, data, default])Return an iterator over the edges. get_edge_data(u, v[, default])Return the attribute dictionary associated with edge (u,v). has_edge(u, v)Return True if the edge (u,v) is in the graph. has_node(n)Return True if the graph contains the node n. has_predecessor(u, v)Return True if node u has predecessor v. has_successor(u, v)Return True if node u has successor v. in_degree([nbunch, weight])Return the in-degree of a node or nodes. in_degree_iter([nbunch, weight])Return an iterator for (node, in-degree). in_edges([nbunch, data])Return a list of the incoming edges. in_edges_iter([nbunch, data])Return an iterator over the incoming edges. is_directed()Return True if graph is directed, False otherwise. is_multigraph()Return True if graph is a multigraph, False otherwise. nbunch_iter([nbunch])Return an iterator of nodes contained in nbunch that are also in the graph. neighbors(n)Return a list of successor nodes of n. neighbors_iter(n)Return an iterator over successor nodes of n. node_dict_factoryalias of dictnodes([data])Return a list of the nodes in the graph. nodes_iter([data])Return an iterator over the nodes. nodes_with_selfloops()Return a list of nodes with self loops. number_of_edges([u, v])Return the number of edges between two nodes. number_of_nodes()Return the number of nodes in the graph. number_of_selfloops()Return the number of selfloop edges. order()Return the number of nodes in the graph. out_degree([nbunch, weight])Return the out-degree of a node or nodes. out_degree_iter([nbunch, weight])Return an iterator for (node, out-degree). out_edges([nbunch, data, default])Return a list of edges. out_edges_iter([nbunch, data, default])Return an iterator over the edges. predecessors(n)Return a list of predecessor nodes of n. predecessors_iter(n)Return an iterator over predecessor nodes of n. remove_edge(u, v)Remove the edge between u and v. remove_edges_from(ebunch)Remove all edges specified in ebunch. remove_node(n)Remove node n. remove_nodes_from(nbunch)Remove multiple nodes. reverse([copy])Return the reverse of the graph. selfloop_edges([data, default])Return a list of selfloop edges. size([weight])Return the number of edges. stacks()Return a dictionary of all node stacks, keyed by node subgraph(nbunch)Return the subgraph induced on nodes in nbunch. successors(n)Return a list of successor nodes of n. successors_iter(n)Return an iterator over successor nodes of n. to_directed()Return a directed representation of the topology. to_undirected()Return an undirected copy of the topology. weights()Return a dictionary of all link weights, keyed by link
DatacenterTopology¶
-
class
DatacenterTopology(data=None, name='', **kwargs)[source]¶ Represent a datacenter topology
Attributes
nameMethods
add_cycle(nodes, **attr)Add a cycle. add_edge(u, v[, attr_dict])Add an edge between u and v. add_edges_from(ebunch[, attr_dict])Add all the edges in ebunch. add_node(n[, attr_dict])Add a single node n and update node attributes. add_nodes_from(nodes, **attr)Add multiple nodes. add_path(nodes, **attr)Add a path. add_star(nodes, **attr)Add a star. add_weighted_edges_from(ebunch[, weight])Add all the edges in ebunch as weighted edges with specified weights. adjacency_iter()Return an iterator of (node, adjacency dict) tuples for all nodes. adjacency_list()Return an adjacency list representation of the graph. adjlist_dict_factoryalias of dictapplications()Return a dictionary of all applications deployed, keyed by node buffers()Return a dictionary of all buffer sizes, keyed by interface capacities()Return a dictionary of all link capacities, keyed by link clear()Remove all nodes and edges from the graph. copy()Return a copy of the topology. degree([nbunch, weight])Return the degree of a node or nodes. degree_iter([nbunch, weight])Return an iterator for (node, degree). delays()Return a dictionary of all link delays, keyed by link edge_attr_dict_factoryalias of dictedges([nbunch, data, default])Return a list of edges. edges_iter([nbunch, data, default])Return an iterator over the edges. get_edge_data(u, v[, default])Return the attribute dictionary associated with edge (u,v). has_edge(u, v)Return True if the edge (u,v) is in the graph. has_node(n)Return True if the graph contains the node n. hosts()Return the list of host nodes in the topology is_directed()Return True if graph is directed, False otherwise. is_multigraph()Return True if graph is a multigraph, False otherwise. nbunch_iter([nbunch])Return an iterator of nodes contained in nbunch that are also in the graph. neighbors(n)Return a list of the nodes connected to the node n. neighbors_iter(n)Return an iterator over all neighbors of node n. node_dict_factoryalias of dictnodes([data])Return a list of the nodes in the graph. nodes_iter([data])Return an iterator over the nodes. nodes_with_selfloops()Return a list of nodes with self loops. number_of_edges([u, v])Return the number of edges between two nodes. number_of_hosts()Return the number of hosts in the topology number_of_nodes()Return the number of nodes in the graph. number_of_selfloops()Return the number of selfloop edges. number_of_switches()Return the number of switches in the topology order()Return the number of nodes in the graph. remove_edge(u, v)Remove the edge between u and v. remove_edges_from(ebunch)Remove all edges specified in ebunch. remove_node(n)Remove node n. remove_nodes_from(nodes)Remove multiple nodes. selfloop_edges([data, default])Return a list of selfloop edges. size([weight])Return the number of edges. stacks()Return a dictionary of all node stacks, keyed by node subgraph(nbunch)Return the subgraph induced on nodes in nbunch. switches()Return the list of switch nodes in the topology to_directed()Return a directed representation of the topology. to_undirected()Return an undirected copy of the topology. weights()Return a dictionary of all link weights, keyed by link
TrafficMatrix¶
-
class
TrafficMatrix(volume_unit='Mbps', flows=None)[source]¶ Class representing a single traffic matrix.
It simply contains a set of traffic volumes being exchanged between origin-destination pairs
Parameters: volume_unit : str
The unit in which traffic volumes are expressed
flows : dict, optional
The traffic volumes or the matrix, keyed by origin-destination pair. The origin-destination pair is a tuple whose two elements are respectively the identifier of the origin and destination nodes and volumes are all expressed in the same unit
Methods
add_flow(origin, destination, volume)Add a flow to the traffic matrix flows()Return the flows of the traffic matrix od_pairs()Return all OD pairs of the traffic matrix pop_flow(origin, destination)Pop a flow from the traffic matrix and return the volume of the flow removed.
TrafficMatrixSequence¶
-
class
TrafficMatrixSequence(interval=None, t_unit='min')[source]¶ Class representing a sequence of traffic matrices.
Parameters: interval : float or int, optional
The time interval elapsed between subsequent traffic matrices of the sequence
t_unit : str, optional
The unit of the interval value (e.g. ‘sec’ or ‘min’)
Methods
append(tm)Append a traffic matrix at the end of the sequence get(i)Return a specific traffic matrix in a specific position of the sequence insert(i, tm)Insert a traffic matrix in the sequence at a specified position pop(i)Removes the traffic matrix in a specific position of the sequence
EventSchedule¶
-
class
EventSchedule(t_start=0, t_unit='ms')[source]¶ Class representing an event schedule. This class is simply a wrapper for a list of events.
Methods
add(time, event[, absolute_time])Adds an event to the schedule. add_schedule(event_schedule)Merge with another event schedule. events_between(t_start, t_end)Return an event schedule comprising all events scheduled between a start time (included) and an end time (excluded). number_of_events()Return the number of events in the schedule pop(i)Remove from the schedule the event in a specific position