Пример #1
0
if not filename:
    print 'Error: first argument missing, input filename with BigGraph archive!'

outname =  len(sys.argv) > 2 and sys.argv[2] or None

if not outname:
    #outname = '/tesis/flickr-growth.txt-200k.big_graph.passive'
    print 'Error: second argument missing, output filename!'
    exit(-1)

print 'opening BigGraph ' + filename
graph = BigGraph(filename)


out = open(outname, 'w')

total_nodes = graph.number_of_nodes()
count = 0
for node, clustering in graph.get_parameter_cache_iter('clustering'):
    
    
    if count % 10000 == 0:
        print 'INFO: exporting clustering %d nodes of %d total nodes' % (count, total_nodes)
        
    out.write('%s\t\t%f\n' % (node, clustering) )
    
    count += 1


Пример #2
0
filename = len(sys.argv) > 1 and sys.argv[1] or None

if not filename:
    #filename = 'orkut-links-fst.txt.toundirected.30mill'
    print 'Error: first argument missing, input filename with space separated graph!'
    exit(-1)

outname = len(sys.argv) > 2 and sys.argv[2] or None

if not outname:
    #outname = 'orkut-2k_sym.big_graph'
    print 'Error: second argument missing, output filename!'
    exit(-1)

graphfile = filename

graph = BigGraph(graphfile)

graph.debug = True
graph.input_debug_links = 200000
graph.output_debug_nodes = 10000

print 'NODES:'
print graph.number_of_nodes()
print 'EDGES:'
print graph.number_of_edges()
print 'dumping Graph to edge list file ...'
graph.save_edgelist(outname)
print 'done.'
Пример #3
0
print 'digraph.load_edgelist(open(filename)) ...'
digraph.load_edgelist(open(filename))

print 'digraph.create_indices() ...'
digraph.create_indices()

graph = BigGraph(graphfile + '.disconnected')

print 'digraph.add_only_symmetric_edgelist(graph) ...'
digraph.add_only_symmetric_edgelist(graph)

print 'graph.create_indices() ...'
graph.create_indices()

number_of_nodes = graph.number_of_nodes()
comps = [
    len(comp) / float(number_of_nodes)
    for comp in graph.connected_components()
]

if comps[0] < 0.5:
    print 'ERROR: biggest connected componnet not found!'
    exit(-1)

print 'input DiGraph:'
print 'nodes = %d' % digraph.number_of_nodes()
print 'edges = %d' % digraph.number_of_edges()

print 'output Graph (possibly disconnected):'
print 'nodes = %d' % graph.number_of_nodes()
Пример #4
0
if not outname:
    print 'Error: second argument missing, output filename for BigGraph!'
    exit(-1)

graph = BigGraph(filename)
#graph = BigGraph()

#graph.add_edge(1,2)
#graph.add_edge(2,3)
#graph.add_edge(3,1)

#graph.add_edge(4,5)

aux_graph = Graph()
connected_graph = BigGraph(outname)

graph.add_random_component(aux_graph)

for src, dst in aux_graph.edges_iter():
    connected_graph.add_edge(src, dst)

connected_graph.create_indices()

print 'input Graph:'
print 'nodes = %d' % graph.number_of_nodes()
print 'edges = %d' % graph.number_of_edges()

print 'output connected Graph:'
print 'nodes = %d' % connected_graph.number_of_nodes()
print 'edges = %d' % connected_graph.number_of_edges()
Пример #5
0
processors = len(strats) * len(lookaheads)  # 4

out = open(outname, 'w')

processes = []
graphs = []
list_of_strategies = []
results = 0
for strat_name in strats:
    for l in lookaheads:

        new_filename = filename + '.%s.lookahead%d' % (strat_name, l)
        graph = BigGraph(new_filename, cache_size_pages)

        max_effort = graph.number_of_nodes() * max_effort_fraction  #

        graph.debug = debug
        graph.input_debug_links = 200000
        graph.output_debug_nodes = 10000

        graph.max_links_input = 1 * 10**8
        graph.max_nodes_analysis = 100000000

        print 'PrivacyAttackStrategies with %s ...' % new_filename
        strategies = PrivacyAttackStrategies(graph, l, coverage_funcs, debug)
        strategies.node_rand_seed = node_rand_seed

        strat = eval('strategies.%s' % strat_name)

        p = Process(target=run,
Пример #6
0
#!/usr/bin/python
'''
Created on May 27, 2010

@author: jose
'''

from cloudlight import BigGraph

import sys

filename =  len(sys.argv) > 1 and sys.argv[1] or None 

if not filename:
    print 'Error: first argument missing, input filename with BigGraph archive!'

print 'opening BigGraph ' + filename
graph = BigGraph(filename)

print 'nodes: %d' % graph.number_of_nodes()
print 'edges: %d' % graph.number_of_edges()