Previous topic


Next topic


This Page


nepidemix.utilities.networkxtra.attributeValueDeal(iterator, attributeValues, graphSize, dealExact=False)

Deal values to a specific attribute of all nodes or edges in a graph.

Parameters :

iterator : networkx.Graph iterator

A networkx node or edge iterator. Note that the iterator functions must be called with data=True.

attributeValues : list

A list of tuples (AttDict, amount). Where AttDict is the attribute dictionary to set and val is a number. If the sum of all val is equal to graphSize this exact number will be dealt. If not val will be normalized so that the sum is equal to graphSize.

graphSize : int

The number of nodes or edges that is to be initialized in the network. Basically the number of items the iterator will acess.

dealExact : bool, optional

If set to True: Force the deal to match the exact number of values. I.e. if the number of given attributes does not match the graph size it will be extended or decreased until it does. This could affect the distribution. If set to False: the number of values will be normalized by the graph size. Default value: False