Пример #1
0
 def test_plot_neighborhood(self):
     """Plots neighborhoods with Igraph"""
     pkg_names="vim nautilus python-apt python-cairo python3".split()
     dn = cxnet.debnetwork()
     for pkg_name in pkg_names:
         dn.cxneighborhood(pkg_name, plot="pdf")
     print("See neighbors_*.pdf .")
Пример #2
0
 def setUp(self):
     self.net = cxnet.debnetwork()
Пример #3
0
#!/usr/bin/env python
# coding: utf-8

"""Saves the deb software package network.

With -u or --upload argument uploades to the django server
if you have permission
"""

from __future__ import division
from __future__ import print_function
import cxnet
import sys
import os

__author__ = 'Arpad Horvath'

net = cxnet.debnetwork()
name0 = net.cxwrite(formats=["graphmlz"])
print("N = {0}, M = {1}".format(net.vcount(), net.ecount()))
if len(sys.argv) >= 2 and sys.argv[1] in ["--upload", "-u"]:
    name = os.path.join("netdata_zip", name0)
    print(name)
    os.system("Djangora-pack {name}.graphmlz".format(name=name))
    value = os.system("cp {name}.graphmlz pack".format(name=name))
    if value:
        print("I could not copy to pack subdirectory"
              " of your actual directory.")

Пример #4
0
# cxnet.Graph   == igraph.Graph
# cxnet.plot    == igraph.plot
# cxnet.summary == igraph.summary
# IN, OUT, WEAK and STRONG are the same in cxnet as in igraph
# cxnet.Network derived from Graph
#     methods added: plot, cx*

# ipython -pylab

import cxnet
net = cxnet.debnetwork()
N = net.vcount()
M = net.ecount()
N, M
cxnet.summary(net)

##############################
#  Components
##############################
scc = net.components()
scc  # strongly connected components
sizes = scc.sizes()
len(sizes)
max(sizes)
giant = scc.giant()  # giant component
cxnet.plot(giant)
giant.plot()
net.cxneighbors("xserver-xorg")
net.cxneighborhood("xserver-xorg", plot=True)
net.cxneighborhood("vim", plot=True)
net.cxneighborhood("evince", plot=True)