Efficient inference algorithms for network activities