The functions and classes documented below are valid if you use the cxnet with igraph. If you want to use cxnet with networkx, the usage of the functions and classes or even the existence of them may differ.
Creates the network of deb packages in Linux distributions using deb packages.
It needs the python-apt package installed.
Loads netdata from a gml file in netdata directory.
If it is not there, it will download it.
Example:
>>> import cxnet
I have found an rc file: /home/ha/.cxnetrc.py.
The graph_module was set in the rc file to "igraph".
I will use igraph. (It have been imported.)
>>> net=cxnet.load_netdata("as-")
'netdata/as-22july06.gml' have been loaded.
>>> print(net.summary())
IGRAPH U--- 22963 48436 -- as-22july06.gml
+ attr: info (g), name (g), id (v), label (v)
>>> print(net['info'])
The file as-22july06.gml contains a symmetrized snapshot of the structure
of the Internet at the level of autonomous systems, reconstructed from BGP
tables posted at archive.routeviews.org. This snapshot was created by Mark
Newman from data for July 22, 2006 and is not previously published.
Get network data from archives.
It stores it in the netdata subdirectory of the current directory. The downloaded zipped files are in the netdata_zip subdirectory of the current directory.
If newman, it downloads a lot of network form Mark Newman’s site.
If deb, it downloads a lot of deb package dependency network created with cxnet.
Example:
>>> import cxnet
I have found an rc file: /home/ha/.cxnetrc.py.
The graph_module was set in the rc file to "igraph".
I will use igraph. (It have been imported.)
>>> cxnet.get_netdata('deb')
ubuntu-10.04-packages-2010-08-19.zip
ubuntu-10.04-packages-2010-08-19.gml, ubuntu-10.04-packages-2010-08-19.txt
ubuntu-10.04-packages-2010-10-25.zip
ubuntu-10.04-packages-2010-10-25.gml, ubuntu-10.04-packages-2010-10-25.txt
ubuntu-9.10-packages-2010-07-16.zip
ubuntu-9.10-packages-2010-07-16.gml, ubuntu-9.10-packages-2010-07-16.txt
ubuntu-9.10-packages-2010-07-22.zip
ubuntu-9.10-packages-2010-07-22.gml, ubuntu-9.10-packages-2010-07-22.txt
debian-6.0-packages-2011-02-03.zip
debian-6.0-packages-2011-02-03.gml, debian-6.0-packages-2011-02-03.txt
The Network class is derived from the igraph.Graph class. The Graph class is imported in the cxnet class for convenience, so it is available as:
The methods of the Graph module is described in the igraph homepage.
Complex Network, Igraph version
Derived from the igraph.Graph class. Methods defined here start with “cx” to find them easier.
It includes the plot function as well.
It is almost same az igraph.plot().
But it has not a graph argument, and left and right margins are wider by default, and edges are orange if there are vertex labels.
Returns with the vertices with the largest degrees.
Only the packages with the degree < limit will listed.
If None, a limit will be set (good for debian package dependency network):
Example:
cn.cxlargest_degree(direction='in', limit=500)
Returns with the successors and predecessors (“out and inneighbors”) if it is a directed networks. Neighbors otherwise.
returns a tuple of (predecessors, successors) where
Returns with the successors and predecessors and the package itself and can plot them.
Example:
>>> import cxnet
>>> cxnet.load_netdata('ubuntu-10.10')
'netdata/ubuntu-10.10-packages-2011-05-01.gml' have been loaded.
>>> net.cxfind('vim')
['jvim-canna', 'libtext-vimcolor-perl', 'vim', 'vim-addon-manager', 'vim-common', 'vim-dbg', 'vim-gnome', 'vim-gtk', 'vim-gui-common', 'vim-latexsuite', 'vim-nox', 'vim-rails', 'vim-runtime', 'vim-tiny', 'vim-vimoutliner']
>>> net.cxneighborhood("vim")
<igraph.VertexSeq object at ...>
>>> net.cxneighborhood("vim", plot=False)
<igraph.VertexSeq object at ...>
Returns with a DegreDistribution class analyzing and plotting distribution.
Returns the ordered list of package names containing the given part.
Make, analyze and plot the degree distribution.
some variables:
more important functions:
Return the cumulative degree distribution
The distribution is a list of (k, P(>k)) pairs.
Plot the cumulative distribution.
Return with exponent and sigma of exponent.
The exponent end error are caculated with the equations written in [1] page 4.
[1]
@article{newman-2005-46,
url = {http://arxiv.org/abs/cond-mat/0412004},
author = {M.~E.~J. Newman},
title = {Power laws, Pareto distributions and Zipf's law},
journal = {Contemporary Physics},
volume = {46},
pages = {323},
year = {2005},
}
[2]
@misc{clauset-2007,
url = {http://arxiv.org/abs/0706.1062},
author = {Aaron Clauset and Cosma Rohilla Shalizi and M.~E.~J. Newman},
title = {Power-law distributions in empirical data},
year = {2007}
}
Plot a power law function with exponent gamma or self.gamma.
Return with the plot.
Sets the type of binning, and calculates the binned distribution.
Plot the bin smeared degree distribution.
Plot the bin smeared degree distribution with loglog scales (log scale in each axes).
Plot the bin smeared degree distribution with semilogy scales (log scale in y axis).
Plot the degree distribution with the fits.
Write informations to screen or file about the distribution.
Parameters:
- file: if string, it will be the name of the file,
- if None (default), it will write to screen (stdout).
- verbosity: integer (0,1,2), default 0
- The bigger the value is, the more information you get.