### Navigation

- index
- modules |
- modules |
- next |
- previous |
- FNSS 0.6.0 documentation »
- API Reference »
- Functions »

# fnss.topologies.topology.fan_in_out_capacities

`fan_in_out_capacities`(topology)

  Calculate fan-in and fan-out capacities for all nodes of the topology.

  The fan-in capacity of a node is the sum of capacities of all incoming links, while the fan-out capacity is the sum of capacities of all outgoing links.

  Parameters: | topology : Topology The topology object whose fan-in and fan-out capacities are calculated. This topology must be annotated with link capacities.
  Returns: | fan_in_out_capacities : tuple (fan_in, fan_out) A tuple of two dictionaries, representing, respectively the fan-in and fan-out capacities keyed by node.

  Notes

  This function works correctly for both directed and undirected topologies. If the topology is undirected, the returned dictionaries of fan-in and fan-out capacities are identical.

  Examples

      >>> import fnss
      >>> topology = fnss.star_topology(3)
      >>> fnss.set_capacities_constant(topology, 10, 'Mbps')
      >>> in_cap, out_cap = fnss.fan_in_out_capacities(topology)
      >>> in_cap
      {0: 30, 1: 10, 2: 10, 3: 10}
      >>> out_cap
      {0: 30, 1: 10, 2: 10, 3: 10}

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- FNSS 0.6.0 documentation »
- API Reference »
- Functions »