Exemple #1
0
already = []
global_eff = 0
all_nodes_number = 0
nr_con = 0
contacts_for_node = []
num_con = 0
new_nr_ac = []
nr_ac = []
efficiency = []
bet_nodes2 = []
bet_nodes3 = []
average_num = []
bet_nodes = []
t = tn.readFile("example_network.tedges",
                sep=" ",
                fformat="TEDGE",
                timestampformat="%s",
                maxlines=sys.maxsize)
t.setMaxTimeDiff(20)
nazwa = "example_network"


def time_table(time_tabel_val, time_table_nr, node_contacts):
    delete_nodes_list(time_table_nr)
    delete_nodes_list(time_table_val)
    to = node_contacts[0][2]
    n = 0
    time_table_val.append(to)
    time_table_nr.append(0)
    for k in range(
            0,
Exemple #2
0
visual_style["layout"] = g2.layout_auto()
visual_style["vertex_label"] = g2.vs["name"]
visual_style["edge_label"] = g2.es["weight"]
igraph.plot(g2, **visual_style)

g2n = t.iGraphSecondOrderNull()
visual_style["edge_label"] = str(g2n.es["weight"])
visual_style["layout"] = g2n.layout_auto()
visual_style["vertex_label"] = g2n.vs["name"]
visual_style["edge_label"] = g2n.es["weight"]
igraph.plot(g2n, **visual_style)

# Read temporal network from sample data file
filename = pkg_resources.resource_filename('pyTempNet', 'example.tedges')

t = tn.readFile(filename, sep=' ')
print("Temporal network has", t.vcount(), "nodes")
print("Temporal network has", t.ecount(), "time-stamped edges")

# If the following explicit call is omitted, the two-path extraction will be 
# executed whenever the time-respecting paths are needed the first time
print("Extracting two-paths ...")
t.extractTwoPaths()
print("Temporal network has", t.TwoPathCount(), "two-paths")

g1 = t.igraphFirstOrder()
print("First-order aggregate network has", len(g1.vs), "nodes and", len(g1.es), "edges")

g2 = t.igraphSecondOrder().components(mode="STRONG").giant()
print("Second-order aggregate network has", len(g2.vs), "nodes and", len(g2.es), "edges")
Exemple #3
0
visual_style["layout"] = g2.layout_auto()
visual_style["vertex_label"] = g2.vs["name"]
visual_style["edge_label"] = g2.es["weight"]
igraph.plot(g2, **visual_style)

g2n = t.igraphSecondOrderNull()
visual_style["edge_label"] = str(g2n.es["weight"])
visual_style["layout"] = g2n.layout_auto()
visual_style["vertex_label"] = g2n.vs["name"]
visual_style["edge_label"] = g2n.es["weight"]
igraph.plot(g2n, **visual_style)

# Read temporal network from sample data file
filename = pkg_resources.resource_filename('pyTempNet', 'example.tedges')

t = tn.readFile(filename, sep=' ')
print("Temporal network has", t.vcount(), "nodes")
print("Temporal network has", t.ecount(), "time-stamped edges")

# If the following explicit call is omitted, the two-path extraction will be 
# executed whenever the time-respecting paths are needed the first time
print("Extracting two-paths ...")
t.extractTwoPaths()
print("Temporal network has", t.TwoPathCount(), "two-paths")

g1 = t.igraphFirstOrder()
print("First-order aggregate network has", len(g1.vs), "nodes and", len(g1.es), "edges")

g2 = t.igraphSecondOrder().components(mode="STRONG").giant()
print("Second-order aggregate network has", len(g2.vs), "nodes and", len(g2.es), "edges")
Exemple #4
0
        for line in f:
            data = line.split("\t")

            nazwa = data[0]
            numero = (int(data[1]))
            delta = (int(data[2]))
            r = (int(data[3]))
            r_num = (int(data[4]))
            f = (int(data[5]))
            f_num = (int(data[6]))
            e = (int(data[7]))
            e_num = (int(data[8]))
            n = (int(data[9]))
            n_num = (int(data[10]))

            t = tn.readFile('/home/marta/Downloads/'+nazwa+'_network.tedges', sep=" ", fformat="TEDGE", timestampformat="%s",
                    maxlines=sys.maxsize)
            # t = tn.readFile('06_05.tedges', sep=" " ,fformat = "TEDGE", timestampformat="%s", maxlines=sys.maxsize)
            #t1 = tn.TemporalNetwork()

            t.setMaxTimeDiff(15)
            #t.setMaxTimeDiff(1)


            #print(t.Summary())

            t.nodes.sort()
            #t.extractTwoPaths()
            #g1 = t.igraphFirstOrder()

            #visual_style = {}
            #visual_style["layout"] = g1.layout_auto()
Exemple #5
0
from subprocess import call
from plotly import tools
from decimal import Decimal
import plotly.graph_objs as go
import random
import matplotlib
plt.switch_backend('agg')
#matplotlib.use('Agg')
# import plotly.figure_factory as ff
# tools.set_credentials_file(username='******', api_key='qiLX2oVUhZgnWOTX6nOV')
import matplotlib.pyplot as pl

#t = tn.readFile('example_network.tedges', sep=" ",fformat = "TEDGE", timestampformat="%s", maxlines=sys.maxsize)
t = tn.readFile('06_05.tedges',
                sep=" ",
                fformat="TEDGE",
                timestampformat="%s",
                maxlines=sys.maxsize)
t.setMaxTimeDiff(20)
t.nodes.sort()
nazwa = '0605'
numero = 100
attack = 0


# utworzenie macierzy polaczen miedzy kontaktami; A i C
# aktywnosc ukladu w czasie, w jednostce czasowej A_sum
def adj2(time_table_val, time_table_nr, a, C, A, A_sum, Nodes_edges, list):
    n = 0
    found = 0
    A_test = np.zeros((len(t.nodes), len(t.nodes)))