fnss.netconfig.capacities.set_capacities_random

set_capacities_random(topology, capacity_pdf, capacity_unit='Mbps')[source]

Set random link capacities according to a given probability density function

Parameters:
topology : Topology

The topology to which link capacities will be set

capacity_pdf : dict

A dictionary representing the probability that a capacity value is assigned to a link

capacity_unit : str, optional

The unit in which capacity value is expressed (e.g. Mbps, Gbps etc..)

links : list, optional

List of links, represented as (u, v) tuples to which capacity will be set. If None or not specified, the capacity will be applied to all links.

Examples

>>> import fnss
>>> topology = fnss.erdos_renyi_topology(50, 0.1)
>>> pdf = {10: 0.5, 100: 0.2, 1000: 0.3}
>>> fnss.set_capacities_constant(topology, pdf, 'Mbps')