pymnet.aggregate

pymnet.aggregate(net, aspects, newNet=None, selfEdges=False)

Reduces the number of aspects by aggregating them.

This function aggregates edges from multilayer aspects together by summing their weights. Any number of aspects is allowed, and the network can have non-diagonal inter-layer links. The layers cannot be weighted such that they would have different coefficients when the weights are summed together.

Note that no self-links are created and all the inter-layer links are disregarded.

Parameters:
netMultilayerNetwork

The original network.

aspectsint or tuple

The aspect which is aggregated over,or a tuple if many aspects

newNetMultilayerNetwork

Empty network to be filled and returned. If None, a new one is created by this function.

selfEdgesbool

If true aggregates self-edges too

Returns:
netMultiplexNetwork

A new instance of multiplex network which is produced.

Examples

Aggregating the network with a singe aspect can be done as follows:

>>> n=net.MultiplexNetwork([('categorical',1.0)])
>>> an=transforms.aggregate(n,1)

You need to choose which aspect(s) to aggregate over if the network has multiple aspects:

>>> n=MultiplexNetwork([2*('categorical',1.0)])
>>> an1=transforms.aggregate(n,1)
>>> an2=transforms.aggregate(n,2)
>>> an12=transforms.aggregate(n,(1,2))