SlideShare uma empresa Scribd logo
1 de 89
Baixar para ler offline
DiktuakoÐ UpologismoÐ me thn Python 
Mwus c A. MpountourÐdhc 
Tm ma Majhmatik¸n PanepisthmÐou Pˆtrac 
mboudour@upatras.gr 
Okt¸brioc–Dekèmbrioc 2014 
Last update: 3–12–2014 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Perieqìmena 
1. Eisagwg  Grˆfwn 
2. BasikoÐ UpologismoÐ thc JewrÐac Grˆfwn 
3. Diktuakˆ Mètra 
4. DiamerismoÐ Grˆfwn 
5. Taxinomhsimìthta – Anameiximìthta 
6. Ekjetikˆ Montèla TuqaÐwn Grˆfwn 
7. Qronik¸c Metaballìmenoi Grˆfoi 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
1. Eisagwg  Grˆfwn 
Egkatˆstash tou NetworkX 
Eisagwg  (Mh Kateujunìmenwn) Grˆfwn 
AploÐ Grˆfoi 
PollaploÐ Grˆfoi 
Eisagwg  Kateujunìmenwn Grˆfwn 
AploÐ Kateujunìmenoi Grˆfoi 
PollaploÐ Kateujunìmenoi Grˆfoi 
Eisagwg  Grˆfwn me Bˆrh Akm¸n 
Eisagwg  Dimer¸n Grˆfwn 
Qarakthristikˆ (Attributes) Kìmbwn kai Akm¸n 
Genn torec Prokataskeuasmènwn Grˆfwn 
OptikopoÐhsh (Visualization) Grˆfwn me to Gephi 
DiepÐpedoi Grˆfoi 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Egkatˆstash tou NetworkX 
To NetworkX eÐnai èna pakèto thc Python gia thn 
dhmiourgÐa, thn diaqeÐrish kai ulopoÐhsh 
upologism¸n gia grˆfouc kai dÐktua. 
To NetworkX diatÐjetai gia katèbasma (mazÐ me 
odhgÐec egkatˆstashc) gia ìla ta leitourgikˆ 
sust mata apì to Python Package Index (pypi) 
sto http://pypi.python.org/pypi/networkx. Efìson 
eÐnai egkatasthmènoc o python package manager pip, 
tìte to NetworkX mporeÐ na egkatastajeÐ 
autìmata mèsw thc (exwterik c sthn Python) 
entol c: 
pip install networkx 
Mèsa sto peribˆllon thc Python, to NetworkX 
kaleÐtai (eisˆgetai) wc ex c: 
import networkx as nx 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Eisagwg  AploÔ (Mh Kateujunìmenou) Grˆfou 
Pr¸ta, dÐnontai oi entolèc gia mh kateujunìmenouc 
grˆfouc. 
Arqikˆ, dhmiourgeÐtai ènac kenìc grˆfoc: 
import networkx as nx 
G = nx. Graph () 
Metˆ, eisˆgontai arqikˆ oi kìmboi, p.q., oi 5 
kìmboi '1', '2', '3', '4' kai '5' mpaÐnoun wc ex c: 
G. add_nodes_from ([1,2,3,4,5]) 
Bèbaia, antÐ gia arijmoÔc, oi kìmboi mporoÔn na 
eisˆgontai wc onìmata   lèxeic, p.q.: 
G. add_nodes_from ([ 'John ', 'Mary ']) 
G. add_node (" London ") 
G. add_nodes_from ([ 'a','b','c','d','e']) 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Gia na doÔme ìlouc touc kìmbouc pou èqoun mpei 
wc t¸ra kai na afairèsoume kˆpoiouc   ìlouc: 
G. nodes () 
G. remove_nodes_from ([ 'John ', 'Mary ']) 
G. clear () 
Sth sunèqeia, eisˆgontai oi akmèc, p.q., gia touc 5 
kìmbouc 1–5 (pou prèpei na epana–eisaqjoÔn), na 
6 sundèseic: 
G. add_nodes_from ([1,2,3,4,5]) 
G. add_edges_from ([(1,2),(1,4),(2,3),(3,4),(3,5),(4,5 )]) 
Oi lÐstec kai to pl joc twn eisaqjèntwn kìmbwn 
kai akm¸n dÐnontai apì tic entolèc: 
G. nodes () 
G. number_of_nodes () 
G. edges () 
G. number_of_edges () 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Gia to sqediasmì tou eisaqjèntoc grˆfou, p.q, 
tou paradeÐgmatoc autoÔ tou grˆfou me 5 
kìmbouc kai 6 akmèc, ekteloÔntai oi entolèc: 
import matplotlib . pyplot as plt 
plt . figure () 
nx. draw (G, with_labels = True ) 
plt . show () 
H teleutaÐa entol  dèqetai diˆforec paramètrouc, 
ìpwc, p.q., gia diaforetikì tÔpo sqedÐou (layout), 
mègejoc kai qr¸ma kìmbwn kai afaÐresh twn 
onomˆtwn (ids) twn kìmbwn: 
nx. draw_spring (G, node_size =100 , node_color ='# A0CBE2 ', 
with_labels = False ) 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
ParaleÐpontac tic prohgoÔmenec parametropoi seic, o sqediasmìc 
tou grˆfou tou paradeÐgmatoc dÐnei to diˆgramma: 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Oi kìmboi mporoÔn na topotethjoÔn se stajerèc (prokajorismènec) 
jèseic, efìson o grˆfoc eÐqe eisaqjeÐ me tic suntetagmènec touc, pou 
mporeÐ na gÐnei, p.q., sto parˆdeigma autì wc ex c: 
pos ={1:(0,0),2:(1,0),4:(0,1),3:(1,1),5:(0.5,2.0)} 
plt . figure () 
nx. draw (G,pos , with_labels = True ) 
plt . show () 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Eisagwg  PollaploÔ (Mh Kateujunìmenou) 
Grˆfou 
'Enac pollaplìc grˆfoc (multigraph) eÐnai ènac 
grˆfoc me pollaplèc (parˆllhlec) akmèc kai 
(endeqomènwc) kai auto–brìgqouc (self–loops). Na 
èna parˆdeigma pollaploÔ (mh kateujunìmenou) 
grˆfou: 
3 
1 2 
O grˆfoc autìc eisˆgetai wc ex c (allˆ den eÐnai 
dunatì na sqediasjeÐ me to NetworkX): 
G = nx. MultiGraph () 
G. add_nodes_from ( range (1,4)) 
G. add_edges_from ([(1,2),(1,2),(1,2),(1,3),(2,2),(2,3),(2,3 )]) 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Eisagwg  AploÔ Kateujunìmenou Grˆfou 
GÐnetai wc ex c, p.q., sto parˆdeigma autì: 
G=nx. DiGraph () 
G. add_nodes_from (["A","B","C","D"]) 
G. add_edges_from ([( "A","B"), ("C","A"), ("C","B"), 
("B","D")]) 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Eisagwg  PollaploÔ Kateujunìmenou Grˆfou 
Na èna parˆdeigma pollaploÔ kateujunìmenou 
grˆfou: 
3 
1 2 
O grˆfoc autìc eisˆgetai wc ex c (allˆ den eÐnai 
dunatì na sqediasjeÐ me to NetworkX): 
G = nx. MultiDiGraph () 
G. add_nodes_from ( range (1,4)) 
G. add_edges_from ([(1,2),(1,2),(2,1),(1,3),(2,2),(2,3),(3,2 )]) 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Eisagwg  Grˆfwn me Bˆrh Akm¸n 
GÐnetai, p.q., sto parˆdeigma autì me tic entolèc: 
G=nx. Graph () 
G. add_weighted_edges_from ([( 'a','b',4),( 'a','c',8), 
('a','d',5),( 'c','d',3)]) 
kai o sqediasmìc wc ex c: 
plt . figure ( facecolor ='w') 
pos =nx. spring_layout (G) 
edge_labels = dict ([((u,v ,),d['weight ']) 
for u,v,d in G. edges ( data = True )]) 
nx. draw_networkx_nodes (G,pos , node_size = 700) 
nx. draw_networkx_edges (G, pos) 
nx. draw_networkx_labels (G,pos , font_size =20) 
nx. draw_networkx_edge_labels (G,pos , 
edge_labels = edge_labels , font_size =20) 
plt . axis ('off ') 
plt . show () 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
AntÐ thc parˆjeshc twn tim¸n twn bar¸n, oi akmèc mporoÔn na 
sqediasjoÔn me eÔrh anˆloga twn tim¸n twn bar¸n wc ex c: 
plt . figure ( facecolor ='w') 
nx. draw_networkx_nodes (G,pos , node_size = 700) 
edgewidth =[] 
for (u,v,d) in G. edges ( data = True ): 
edgewidth . append (d['weight ']) 
nx. draw_networkx_edges (G,pos , edge_color ='b', width = edgewidth ) 
nx. draw_networkx_labels (G,pos , font_size =20) 
plt . axis ('off ') 
plt . show () 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Epiplèon, mporoÔn na krathjoÔn sto sqèdio mìno oi akmèc me bˆrh 
megalÔtera kˆpoiac endiˆmeshc tim c, p.q., 4: 
elarge = [(u,v) for (u,v,d) in G. edges ( data = True ) 
if d['weight '] >4] 
esmall = [(u,v) for (u,v,d) in G. edges ( data = True ) 
if d['weight '] <=4] 
plt . figure ( facecolor ='w') 
nx. draw_networkx_nodes (G,pos , node_size = 700) 
nx. draw_networkx_edges (G,pos , edgelist = elarge , 
edge_color ='b',width = edgewidth ) 
nx. draw_networkx_edges (G,pos , edgelist = esmall , width =6, 
alpha =0.5, edge_color ='g',style ='dashed ') 
nx. draw_networkx_labels (G,pos , font_size =20) 
plt . axis ('off ') 
plt . show () 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Eisagwg  Dimer¸n Grˆfwn 
H eisagwg  dimer¸n grˆfwn gÐnetai ìpwc, p.q., 
sto parakˆtw parˆdeigma: 
from networkx . algorithms import bipartite 
G = nx. Graph () 
G. add_nodes_from ([1,2,3,4], bipartite =0) 
G. add_nodes_from ([ 'a','b','c'], bipartite =1) 
G. add_edges_from ([(1,'a'),(1,'b'),(2,'a'),(2,'b'), 
(2,'c'),(3,'c'),(4,'b'),(4,'c')]) 
pos ={1:(0,0), 
2:(0,1), 
3:(0,2), 
4:(0,3), 
'a':(1,0.5), 
'b':(1,1.5), 
'c':(1,2.5)} 
O èlegqoc an prìkeitai perÐ dimeroÔc grˆfou 
(True)   ìqi (False) gÐnetai me thn entol : 
print bipartite . is_bipartite (G) 
% True 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
O sqediasmìc tou dimeroÔc grˆfou gÐnetai wc 
ex c: 
mode1 , mode2 = bipartite . sets (G) 
plt . figure ( facecolor ='w') 
nx. draw_networkx_nodes (G,pos , nodelist = list ( mode1 ), 
node_color ='b',node_size = 700) 
nx. draw_networkx_nodes (G,pos , nodelist = list ( mode2 ), 
node_color ='g',node_size = 700) 
nx. draw_networkx_edges (G, pos) 
nx. draw_networkx_labels (G,pos , font_size =20 , 
font_color ='# FFFFFF ') 
plt . axis ('off ') 
plt . show () 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Qarakthristikˆ (Attributes) Kìmbwn kai Akm¸n 
Ta qarakthristikˆ twn kìmbwn mpaÐnoun wc ex c 
(sto parˆdeigma autì gia to qarakthristikì tou 
qr¸matoc): 
G = nx. Graph () 
G. add_node (1, color ='red ') 
G. add_node (2, color ='blue ') 
G. add_node (3, color ='green ') 
G. add_edges_from ([(1,2),(1,3),(2,3 )]) 
G. node [1] 
G. node [1][ 'color '] 
G. nodes ( data = True ) 
G. add_nodes_from ([(1, {'color ': 'red '}), (2, {'color ': 'blue '}), 
(3, {'color ': 'green '} )]) 
custom_node_color ={} 
custom_node_color [1] = 'r' 
custom_node_color [2] = 'b' 
custom_node_color [3] = 'g' 
plt . figure () 
nx. draw (G, node_list = custom_node_color . keys (), 
node_color = custom_node_color . values ()) 
plt . show () 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Ta qarakthristikˆ twn akm¸n mpaÐnoun wc ex c 
(sto parˆdeigma autì gia to qarakthristikì tou 
qrìnou): 
G = nx. Graph () 
G. add_edge (1, 2, time ='May ') 
G. add_edge (2, 3, time ='June ') 
G. add_edge (3, 4, time ='July ') 
G. add_edge (4, 1, time ='August ') 
G. edge [1][2] 
G. edge [1][2][ 'time '] 
G. edges ( data = True ) 
G. add_edges_from ([(1, 2, {'time ': 'May '}), (1, 4, {'time ': 'August '}), 
(2, 3, {'time ': 'June '}), (3, 4, {'time ': 'July '} )]) 
edgelist = [(1,2),(2,3),(3,4),(1,4)] 
colorlist =[ 'r','b','g','k'] 
pos =nx. spring_layout (G) 
plt . figure ( facecolor ='w') 
nx. draw_networkx_nodes (G,pos , with_labels = True ) 
nx. draw_networkx_labels (G,pos , font_size =10) 
nx. draw_networkx_edges (G,pos , edgelist = edgelist , edge_color = colorlist ) 
plt . axis ('off ') 
plt . show () 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Genn torec Prokataskeuasmènwn Grˆfwn 
Oi prokajorismènoi grˆfoi eisˆgontai wc 
G = nx.graph - name ( parameters ) 
ìpou to "ìnoma–grˆfou" kai oi "parˆmetroi’’ eÐnai 
ìpwc dÐnontai sth sunèqeia. 
Gia ton sqediasmì twn prokajorismènwn grˆfwn 
(qwrÐc parametropoi seic) oi entolèc eÐnai: 
plt . figure () 
nx. draw (G, with_labels = False ) 
plt . show () 
Perissìteroi prokataskeuasmènoi grˆfoi tou 
NetworkX dÐnontai sth selÐda: 
https://networkx.github.io/documentation/latest/reference/generators.html 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
1 AploÐ kai GnwstoÐ Prokataskeuasmènoi Grˆfoi 
KÔkloc n kìmbwn: 
cycle_graph (n) 
Astèri n + 1 kìmbwn: 
star_graph (n) 
Diadrom  n kìmbwn: 
path_graph (n) 
Grˆfoc aetoÔ tou Krackhardt: 
krackhardt_kite_graph () 
Grˆfoc Flwrentian¸n oikogenei¸n: 
florentine_families_graph () 
Grˆfoc tou karˆte klamp: 
karate_club_graph () 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
K¸dikac gia ton sqediasmì twn epìmenwn diktÔwn: 
G1 = nx. cycle_graph (10) 
G2 = nx. star_graph (6) 
G3 = nx. path_graph (6) 
G4 = nx. krackhardt_kite_graph () 
G5 = nx. florentine_families_graph () 
G6 = nx. karate_club_graph () 
fig = plt . figure ( figsize =(10 ,10 )) 
plt . subplot (2,3,1). set_title (" Cycle ") 
nx. draw (G1 , node_size =40 , with_labels = False ); plt . axis (" tight ") 
plt . subplot (2,3,2). set_title (" Star ") 
nx. draw (G2 , node_size =40 , with_labels = False ); plt . axis (" tight ") 
plt . subplot (2,3,3). set_title (" Path ") 
nx. draw (G3 , node_size =40 , with_labels = False ); plt . axis (" tight ") 
plt . subplot (2,3,4). set_title (" Krackhardt kite ") 
nx. draw (G4 , node_size =40 , with_labels = False ); plt . axis (" tight ") 
plt . subplot (2,3,5). set_title (" Florentine families ") 
nx. draw (G5 , node_size =40 , with_labels = False ); plt . axis (" tight ") 
plt . subplot (2,3,6). set_title (" Karate club ") 
nx. draw (G6 , node_size =40 , with_labels = False ); plt . axis (" tight ") 
plt . show () 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
3 TuqaÐoi Grˆfoi 
TuqaÐoc grˆfoc Erdos–Renyi gia n kìmbouc kai pijanìthta p: 
erdos_renyi_graph (n,p) 
TuqaÐoc grˆfoc Gn,p gia n kìmbouc kai pijanìthta p: 
gnp_random_graph (n,p) 
TuqaÐoc grˆfoc Gn,m gia n kìmbouc kai m akmèc: 
gnm_random_graph (n,m) 
Grˆfoc anadiktÔwshc plègmatoc Strogatz–Watts gia n kìmbouc, o 
kajènac me k geÐtonec (se topologÐa daktulÐou) kai me pijanìthta 
anadiktÔwshc p: 
watts_strogatz_graph (n,k,p) 
TuqaÐoc grˆfoc Barabasi–Albert gia n kìmbouc kai kˆje nèo kìmbo me 
m akmèc se upˆrqontec kìmbouc: 
barabasi_albert_graph (n,m) 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
K¸dikac gia ton sqediasmì twn epìmenwn diktÔwn: 
G9 = nx. erdos_renyi_graph (20 ,0.2) 
G10 = nx. erdos_renyi_graph (20 ,0.1) 
G11 = nx. gnp_random_graph (25 ,0.1) 
G12 = nx. gnm_random_graph (20 ,15) 
G13 = nx. watts_strogatz_graph (10 ,2,0.4) 
G14 = nx. barabasi_albert_graph (40 ,3) 
fig = plt . figure ( figsize =(10 ,10 )) 
plt . subplot (2,3,1). set_title (" Erdos Renyi (p=0.2)") 
nx. draw (G9 , node_size =40 , with_labels = False ); plt . axis (" tight ") 
plt . subplot (2,3,2). set_title (" Erdos Renyi (p=0.1)") 
nx. draw (G10 , node_size =40 , with_labels = False ); plt . axis (" tight ") 
plt . subplot (2,3,3). set_title (" Random graph G_{n,p} ") 
nx. draw (G11 , node_size =40 , with_labels = False ); plt . axis (" tight ") 
plt . subplot (2,3,4). set_title (" Random graph G_{n,m}") 
nx. draw (G12 , node_size =40 , with_labels = False ); plt . axis (" tight ") 
plt . subplot (2,3,5). set_title (" Strogatz - Watts ") 
nx. draw (G13 , node_size =40 , with_labels = False ); plt . axis (" tight ") 
plt . subplot (2,3,6). set_title (" Barabasi - Albert ") 
nx. draw (G14 , node_size =40 , with_labels = False ); plt . axis (" tight ") 
plt . show () 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
OptikopoÐhsh (Visualization) Grˆfwn me to Gephi 
Pr¸ta orÐzoume to working directory ìpou jèloume h Python na s¸sei 
ton grˆfo, ton opoÐon ja sqediˆsoume sth sunèqeia mèsw tou Gephi: 
import os 
os. chdir ('pwd ') 
ìpou to ’pwd’ antistoiqeÐ sth diadrom  ston upostologist  mac. 
Sth sunèqeia, eisˆgoume ton grˆfo sto NetworkX. P.q.: 
G = nx. erdos_renyi_graph (200 ,0.01) 
Amèswc metˆ, exˆgoume autìn ton grˆfo wc arqeÐo .gexf, gia na ton 
epexergasjeÐ to Gephi: 
nx. write_gexf (G,'ern . gexf ') 
Sto Gephi, proqwroÔme wc ex c: 
Open Graph File... 
Overview 
Layout > Apply (Stop) 
Data Laboratory > Add column [color] > Fill column with a value 
Partition (refresh) choose color > Apply 
Preview (refress) 
Presets > Default Straight 
Export (gia na s¸soume to diˆgramma tou grˆfou, sun jwc wc 
.png   pdf.) 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Sq ma: TuqaÐoc grˆfoc Erdos–Renyi gia 200 kìmbouc kai pijanìthta 
0.01 sqediasmènoc me to Gephi. 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
DiepÐpedoi Grˆfoi 
DiepÐpedoc grˆfoc (two–level graph) onomˆzetai ènac grˆfoc, to 
sÔnolo koruf¸n tou opoÐou diamerÐzetai se duo uposÔnola, pou 
onomˆzontai epÐpeda, ètsi ¸ste to sÔnolo twn akm¸n tou grˆfou na 
diamerÐzetai se trÐa uposÔnola: akmèc metaxÔ twn koruf¸n tou 
pr¸tou epipèdou, akmèc metaxÔ twn koruf¸n tou deutèrou epipèdou 
kai akmèc metaxÔ twn koruf¸n tou pr¸tou kai tou deutèrou 
epipèdou. Me ˆlla lìgia, h diaforˆ diepÐpedou kai dimeroÔc grˆfou 
eÐnai ìti ston deÔtero den mporoÔn na upˆrqoun akmèc metaxÔ twn 
koruf¸n tou pr¸tou kai tou deutèrou epipèdou. 
Mia pr¸th kataskeu  mporeÐ na gÐnei analutikˆ, ’’aposunjètontac’’ 
to sÔnolo twn koruf¸n enìc dojèntoc grˆfou se duo epÐpeda, ìpwc 
perigrˆfetai me tic parakˆtw grammèc k¸dika (ki akoloujeÐ o 
sqediasmìc tou grˆfou autoÔ sthn epìmenh diafˆneia): 
G=nx. erdos_renyi_graph (20 ,0.3) 
pos =nx. spring_layout (G) 
top_set = range (0,8) 
botom_set = range (8,20) 
for i in pos : 
npos = pos [i] 
if i in top_set : 
pos [i ]=[ npos [0], npos [1]+2] 
elif i in botom_set : 
pos [i ]=[ npos [0], npos [1]-2] 
plt . figure () 
nx. draw (G,pos , with_labels =True , nodelist = top_set , node_color ='r') 
nx. draw (G,pos , with_labels =True , nodelist = botom_set , node_color ='b') 
plt . show () 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mia deÔterh kataskeu  enìc diepÐpedou grˆfou mporeÐ na gÐnei 
sunjetikˆ, ’’gefur¸nontac’’ duo dojèntec grˆfouc me thn prosj kh 
akm¸n metaxÔ tou sunìlou twn koruf¸n tou pr¸tou grˆfou kai 
tou sunìlou twn koruf¸n tou deutèrou grˆfou: 
J=nx. erdos_renyi_graph (15 ,0.17) # First level graph 
F=nx. erdos_renyi_graph (20 ,0.17) # Second level graph 
H=nx. bipartite_random_graph (15 ,20 ,0.1) # The bridging bipartite graph 
G=nx. Graph () # The two -- level graph 
for node in J. nodes (): 
G. add_node (node , bipartite =0) 
for edge in J. edges (): 
G. add_edge ( edge [0], edge [1]) 
for edge in F. edges (): 
G. add_edge ( edge [0]+k, edge [1]+k) 
for node in F. nodes (): 
G. add_node ( node +k, bipartite =1) 
for edge in H. edges ( data = True ): 
G. add_edge ( edge [0], edge [1]) 
pos =nx. spring_layout (G) 
top_set = set () 
botom_set = set () 
for i in pos : 
npos = pos [i] 
if G. node [i][ 'bipartite ']== 0: 
pos [i ]=[ npos [0], npos [1]+2] 
top_set .add(i) 
elif G. node [i][ 'bipartite ']== 1: 
pos [i ]=[ npos [0], npos [1]-2] 
botom_set . add (i) 
plt . figure () 
nx. draw (G,pos , with_labels =True , nodelist = list ( top_set ), node_color ='r') 
nx. draw (G,pos , with_labels =True , nodelist = list ( botom_set ), node_color ='b') 
plt . show () 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Se aut n kai thn epìmenh diafˆneia dÐnetai o k¸dikac kataskeu c 
enìc diepÐpedou grˆfou tou paradeÐgmatoc dieujunt¸n–etairei¸n 
(managers–companies). Sth mejepìmenh diafˆneia akoloujeÐ o k¸dikac 
tou sqediasmoÔ tou grˆfou autoÔ, ìpwc apeikonÐzetai sthn amèswc 
epìmenh diafˆneia: 
directors = {0:"a",1:"b",2:"c",3:"d",4:"e"} 
companies ={0:"A",1:"B",2:"C",3:"D",4:"E",5:"F"} 
labels = directors . copy () 
newkey = len ( directors . keys ()) 
for k in companies . keys (): 
labels [k+ newkey ]= companies [k] 
J=nx. erdos_renyi_graph (5,0.8) # Directors 
F=nx. erdos_renyi_graph (6,0.6) # Companies 
H=nx. bipartite_random_graph (5,6,0.55) # Directors in Companies 
G=nx. Graph () #Two - Level Graph 
from networkx . algorithms import bipartite 
for node in J. nodes (): 
G. add_node (node , bipartite =0) 
for edge in J. edges (): 
G. add_edge ( edge [0], edge [1]) 
for edge in F. edges (): 
G. add_edge ( edge [0]+5, edge [1]+5) 
for node in F. nodes (): 
G. add_node ( node +5, bipartite =1) 
for edge in H. edges ( data = True ): 
G. add_edge ( edge [0], edge [1]) 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
posJ =nx. spring_layout (J) 
posF =nx. spring_layout (F) 
posH ={0:(0,0),1:(0,2),2:(0,4),3:(0,6),4:(0,8),5:(1,-2),6:(1,0),7:(1,2),8:(1,4), 
9:(1,6),10 :(1,8)} 
mode1 , mode2 = bipartite . sets (H) 
pos =nx. spring_layout (G) 
top_set =set () 
botom_set = set () 
for i in pos : 
npos = pos [i] 
if G. node [i][ 'bipartite ']== 0: 
pos [i ]=[ npos [0], npos [1]+2] 
top_set .add(i) 
elif G. node [i][ 'bipartite ']== 1: 
pos [i ]=[ npos [0], npos [1]-2] 
botom_set .add(i) 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
fig = plt . figure ( figsize =(13 ,13 )) 
plt . subplot (2,2,1). set_title (" Friendship Network of Directors ") 
nx. draw (J, pos =posJ , node_color ='r',node_size =700 , font_size =20 , font_color ='# FFFFFF ', 
with_labels = False ) 
nx. draw_networkx_labels (J,posJ , directors , font_size =20 , font_color ='# FFFFFF ') 
plt . axis (" tight ") 
plt . subplot (2,2,2). set_title (" Collaboration Network of Companies ") 
nx. draw (F, pos =posF , node_color ='b',node_size =800 , font_size =20 , font_color ='# FFFFFF ', 
node_shape ='s', with_labels = False ) 
nx. draw_networkx_labels (F,posF , companies , font_size =20 , font_color ='# FFFFFF ') 
plt . axis (" tight ") 
plt . subplot (2,2,3). set_title ("Two - Mode network of Directors and Companies ") 
nx. draw_networkx_nodes (H, pos =posH , nodelist = list ( mode1 ), node_color ='r', 
node_size = 700) 
nx. draw_networkx_nodes (H, pos =posH , nodelist = list ( mode2 ), node_color ='b', 
node_size =800 , node_shape ='s') 
nx. draw_networkx_edges (H, pos = posH ) 
nx. draw_networkx_labels (H,posH ,labels , font_size =20 , font_color ='# FFFFFF ') 
plt . axis ('off ') 
plt . axis (" tight ") 
plt . subplot (2,2,4). set_title ("Two - Level Network of Directors and Companies ") 
nx. draw (G,pos , nodelist = list ( top_set ), node_color ='r',node_size =700 , 
with_labels = False ) 
nx. draw (G,pos , nodelist = list ( botom_set ), node_color ='b',node_size =800 , 
node_shape ='s', with_labels = False ) 
nx. draw_networkx_labels (G,pos , labels , font_size =20 , font_color ='# FFFFFF ') 
plt . axis (" tight ") 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
SunjetikoÐ EgwkentrikoÐ Grˆfoi 
Egwkentrikìc grˆfoc   dÐktuo (egocentric graph/network) onomˆzetai ènac grˆfoc, gia ton 
opoÐon upˆrqei mia koruf , pou onomˆzontai ’’eg¸,’’, h opoÐa sundèetai me ìlec tic ˆllec 
korufèc tou grˆfou autoÔ. AkoloujeÐ mia sunjetik  kataskeu  wc eidik  perÐptwsh 
sunjetikoÔ diepÐpedou grˆfou, ston opoÐon to èna apì ta duo epÐpeda apoteleÐtai apì mia 
mình koruf  (to ’’eg¸’’), h opoÐa sundèetai me ìlec tic korufèc tou ˆllou epipèdou: 
J=nx. erdos_renyi_graph (20 ,0.1) 
F=nx. erdos_renyi_graph (1,1) 
H=nx. bipartite_random_graph (20 ,1,1) 
G=nx. Graph () 
for node in J. nodes (): 
G. add_node (node , bipartite =0) 
for edge in J. edges (): 
G. add_edge ( edge [0], edge [1]) 
for edge in F. edges (): 
G. add_edge ( edge [0]+k, edge [1]+k) 
for node in F. nodes (): 
G. add_node ( node +k, bipartite =1) 
for edge in H. edges ( data = True ): 
G. add_edge ( edge [0], edge [1]) 
pos =nx. spring_layout (G) 
top_set = set (); botom_set =set () 
for i in pos : 
npos = pos [i] 
if G. node [i][ 'bipartite ']== 0: 
pos [i ]=[ npos [0], npos [1]+2] 
top_set .add(i) 
elif G. node [i][ 'bipartite ']== 1: 
pos [i ]=[ npos [0], npos [1]-2] 
botom_set . add (i) 
plt . figure () 
nx. draw (G,pos , with_labels =True , nodelist = list ( top_set ), node_color ='r') 
nx. draw (G,pos , with_labels =True , nodelist = list ( botom_set ), node_color ='b') 
plt . show () 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
2. BasikoÐ UpologismoÐ thc JewrÐac 
Grˆfwn 
GeitnÐash Kìmbwn 
BajmoÐ Kìmbwn 
BajmoÐ Kìmbwn Mh Kateujunìmenwn Grˆfwn 
BajmoÐ Kìmbwn Kateujunìmenwn Grˆfwn 
Rabdogrˆmmata Bajm¸n Kìmbwn Grˆfwn 
Istogrˆmmata Katanom c Bajm¸n Kìmbwn Grˆfwn 
Istogrˆmmata Katanom c Bajm¸n Kìmbwn Megˆlwn Grˆfwn 
Sundesimìthta 
Sundedemènec Sunist¸sec Mh Kateujunìmenwn Grˆfwn 
Isqur¸c Sundedemènec Sunist¸sec Kateujunìmenwn Grˆfwn 
Asjen¸c Sundedemènec Sunist¸sec Kateujunìmenwn Grˆfwn 
Elkustikèc Sunist¸sec Kateujunìmenwn Grˆfwn 
Disundedemènec Sunist¸sec Mh Kateujunìmenwn Grˆfwn 
KlÐkec Kìmbwn 
Algìrijmoi BFS, DFS kai Dkstra 
Apostˆseic Kìmbwn 
Upogrˆfoi kai IsomorfismoÐ Grˆfwn 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
GeitnÐash Kìmbwn 
1 GeitnÐash Kìmbwn se Mh Kateujunìmenouc 
Grˆfouc 
'Estw ìti èqoume ènan mh kateujunìmeno (aplì) grˆfo 
G. 
Oi parakˆtw entolèc dÐnoun antistoÐqwc: to sÔnolo 
twn kìmbwn, to sÔnolo twn akm¸n kai touc geÐtonec 
tou kìmbou i tou G: 
G. nodes () 
G. edges () 
G. neighbors (i) 
O pÐnakac geitnÐashc A tou grˆfou G, pou eÐnai ènac 
summetrikìc pÐnakac n  n (ìpou n eÐnai to pl joc twn 
kìmbwn tou G) me stoiqeÐa 0   1, upologÐzetai kai 
tup¸netai apì tic ex c entolèc: 
A = nx. adjacency_matrix (G) 
print (A. todense ()) 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Gia parˆdeigma, gia ton tuqaÐo grˆfo Erdos–Renyi 
G =nx. erdos_renyi_graph (10 ,0.5) 
brÐskoume ta ex c sÔnola kìmbwn, akm¸n, geitìnwn tou 
kìmbou 4 kai pÐnaka geitnÐashc tou grˆfou 
(antistoÐqwc): 
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 
[(0, 9), (0, 5), (0, 6), (0, 7), (1, 2), (1, 4), (1, 5), (1, 7), (1, 8), 
(1, 9), (2, 8), (2, 9), (2, 7), (3, 8), (3, 9), (3, 5), (3, 6), (3, 7), 
(4, 8), (4, 5), (5, 6), (5, 7), (5, 8), (6, 7), (7, 9), (8, 9)] 
[8, 1, 5] 
[[0 1 1 0 0 0 0 1 0 1] 
[1 0 0 1 0 1 0 0 0 0] 
[1 0 0 0 1 1 1 0 0 0] 
[0 1 0 0 0 0 0 0 1 0] 
[0 0 1 0 0 1 1 0 1 0] 
[0 1 1 0 1 0 0 1 1 0] 
[0 0 1 0 1 0 0 0 1 0] 
[1 0 0 0 0 1 0 0 0 1] 
[0 0 0 1 1 1 1 0 0 0] 
[1 0 0 0 0 0 0 1 0 0]] 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
O sqediasmìc tou grˆfou mporeÐ na gÐnei me tic 
entolèc: 
plt . figure () 
nx. draw (G, with_labels =True , node_color ='g',alpha =0.5) 
plt . show () 
Epiplèon, gia ton pÐnaka geitnÐashc, mporoÔme na 
sqediˆsoume to kaloÔmeno spy plot me ton ex c trìpo: 
adjacency_matrix = nx. to_numpy_matrix (G) 
fig = plt . figure ( figsize =(5, 5)) 
plt . imshow ( adjacency_matrix , cmap = Greys , interpolation = none ) 
plt . show () 
Ta sqèdia tou grˆfou kai tou spy plot tou pÐnaka 
geitnÐas c tou brÐskontai sthn epìmenh diafˆneia. 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
2 GeitnÐash Kìmbwn se Kateujunìmenouc Grˆfouc 
'Estw t¸ra ìti èqoume ènan kateujunìmeno grˆfo G. 
Oi parakˆtw entolèc dÐnoun antistoÐqwc: to sÔnolo twn kìmbwn, to 
sÔnolo twn akm¸n, touc exerqìmenouc geÐtonec tou kìmbou i proc touc 
opoÐouc kateujÔnontai oi akmèc pou arqÐzoun apì ton i kai touc 
eiserqìmenouc geÐtonec tou kìmbou i apì touc opoÐouc arqÐzoun oi 
akmèc pou kateujÔnontai ston i: 
G. nodes () 
G. edges () 
G. neighbors (i) 
G. predecessors (i) 
O pÐnakac geitnÐashc A tou grˆfou G, pou eÐnai t¸rac ènac mh 
summetrikìc pÐnakac n n (ìpou n eÐnai to pl joc twn kìmbwn tou G) 
me stoiqeÐa 0   1, upologÐzetai kai tup¸netai apì tic Ðdiec entolèc: 
A = nx. adjacency_matrix (G) 
print (A. todense ()) 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Gia parˆdeigma, gia ton kateujunìmeno tuqaÐo grˆfo Erdos–Renyi 
G = nx. erdos_renyi_graph (10 ,0.5, directed = True ) 
brÐskoume ta ex c sÔnola kìmbwn, akm¸n, exerqìmenwn geitìnwn tou 
kìmbou 4, eiserqìmenwn geitìnwn tou kìmbou 4 kai pÐnaka geitnÐashc 
tou grˆfou (antistoÐqwc): 
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] 
[(0, 8), (0, 1), (0, 6), (0, 7), (1, 8), (1, 9), (1, 3), (1, 5), (1, 6), 
(2, 0), (2, 3), (2, 4), (2, 5), (2, 6), (2, 7), (2, 8), (2, 9), (3, 0), 
(3, 1), (3, 2), (3, 4), (3, 8), (3, 9), (4, 8), (4, 1), (4, 2), (4, 6), 
(4, 7), (5, 0), (5, 1), (5, 2), (5, 3), (5, 9), (6, 2), (6, 4), (6, 5), 
(7, 0), (7, 1), (7, 2), (7, 3), (7, 5), (7, 8), (7, 9), (8, 0), (8, 1), 
(8, 2), (8, 3), (8, 6), (8, 9), (9, 8), (9, 5), (9, 6), (9, 7)] 
[8, 1, 2, 6, 7] 
[2, 3, 6] 
[[0 1 0 0 0 0 1 1 1 0] 
[0 0 0 1 0 1 1 0 1 1] 
[1 0 0 1 1 1 1 1 1 1] 
[1 1 1 0 1 0 0 0 1 1] 
[0 1 1 0 0 0 1 1 1 0] 
[1 1 1 1 0 0 0 0 0 1] 
[0 0 1 0 1 1 0 0 0 0] 
[1 1 1 1 0 1 0 0 1 1] 
[1 1 1 1 0 0 1 0 0 1] 
[0 0 0 0 0 1 1 1 1 0]] 
Sthn epìmenh diafˆneia, blèpoume ton sqediasmì tou grˆfou autoÔ 
kai to spy plot tou pÐnaka geitnÐas c tou, pou èginan me tic Ðdiec 
entolèc sqediasmoÔ pou dìjhkan gia thn perÐptwsh twn mh 
kateujunìmenwn grˆfwn. 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
BajmoÐ Kìmbwn 
1 BajmoÐ Kìmbwn Mh Kateujunìmenwn Grˆfwn 
'Estw ìti èqoume ènan mh kateujunìmeno (aplì) grˆfo 
G. 
O bajmìc tou kìmbou i tou G orÐzetai wc to pl joc 
twn geitìnwn tou i. 
Oi parakˆtw entolèc dÐnoun antistoÐqwc: ton bajmì 
tou kìmbou i kai to sÔnolo–lexikì twn bajm¸n ìlwn 
twn kìmbwn tou G: 
G. degree (i) 
G. degree () # the same as nx . degree (G) 
To diˆgramma tou mh kateujunìmenou grˆfou tou 
prohgoÔmenou paradeÐgmatoc sqediˆzetai sthn epìmenh 
diafˆneia ètsi ¸ste na faÐnetai o kìmboc i, oi geÐtonèc 
tou ki o bajmìc tou i (ed¸ i = 4). 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
2 BajmoÐ Kìmbwn Kateujunìmenwn Grˆfwn 
'Estw t¸ra ìti èqoume ènan kateujunìmeno grˆfo G. 
O exerqìmenoc bajmìc (out–degree) tou kìmbou i tou G 
orÐzetai wc to pl joc twn exerqìmenwn geitìnwn tou i 
kai o eiserqìmenoc bajmìc (in–degree) tou kìmbou i tou 
G orÐzetai wc to pl joc twn eiserqìmenwn geitìnwn 
tou i. O olikìc bajmìc (total degree) tou i orÐzetai wc 
to ˆjroisma tou exerqìmenou kai tou eiserqìmenou 
bajmoÔ tou i. 
Oi parakˆtw entolèc dÐnoun antistoÐqwc: ton 
exerqìmeno, eiserqìmeno, olikì bajmì tou kìmbou i kai 
ta sÔnola–lexikˆ twn antÐstoiqwn bajm¸n ìlwn twn 
kìmbwn tou G: 
G. out_degree (i) # the same as len (G. neighbors (i)) 
G. in_degree (i) # the same as len (G. predecessors (i )) 
G. degree () # the same as nx . degree (G) = G. out_degree (i) + G. in_degree (i) 
Sthn epìmenh diafˆneia faÐnontai oi bajmoÐ enìc kìmbou gia to 
parˆdeigmˆ mac. 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
3 Rabdogrˆmmata Bajm¸n Kìmbwn Grˆfwn 
'Ena rabdìgramma bajm¸n kìmbwn eÐnai apl¸c h 
grafik  parˆstash thc metabol c twn diatetagmènwn 
se fjÐnousa seirˆ bajm¸n twn kìmbwn enìc grˆfou, oi 
opoÐoi kìmboi paratÐjentai me thn antÐstoiqh (proc 
touc bajmoÔc) seirˆ, ston ˆxona x. 
Gia ènan mh kateujunìmeno grˆfo G, qrhsimopoioÔme tic 
parakˆtw entolèc gia thn paragwg  kai ton 
sqediasmì tou rabdogrˆmmatoc autoÔ: 
deg =G. degree () 
deg_dic = dict () 
for nd in deg : 
if deg [nd] not in deg_dic : 
deg_dic [deg[nd ]]=[ nd] 
else : 
deg_dic [deg[nd ]]. append (nd) 
deg_lis =[] 
nd_lis =[] 
for de in sorted ( deg_dic . keys (), reverse = True ): 
for nn in deg_dic [de ]: 
deg_lis . append (de) 
nd_lis . append (nn) 
index = np. arange ( len ( nd_lis )) 
bar_width = 1 
plt . bar (index , deg_lis , bar_width , color ='g') 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Sto sq ma pou akoloujeÐ blèpoume èna parˆdeigma enìc 
rabdogrˆmmatoc bajm¸n enìc mh kateujunìmenou grˆfou: 
'Otan o grˆfoc eÐnai kateujunìmenoc, èqoume afenìc to rabdìgramma 
twn exerqìmenwn bajm¸n kìmbwn kai afetèrou to rabdìgramma twn 
eiserqìmenwn bajm¸n kìmbwn. Oi tropopoi seic tou prohgoÔmenou 
k¸dika gia rabdogrˆmmata mh kateujunìmenwn grˆfwn eÐnai 
profaneÐc. 
Sthn epìmenh diafˆneia akoloujoÔn paradeÐgmata rabdogrammˆtwn 
exerqìmenwn kai eiserqìmenwn bajm¸n enìc kateujunìmenou grˆfou. 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
4 Istogrˆmmata Katanom c Bajm¸n Kìmbwn Grˆfwn 
'Ena istìgramma katanom c bajm¸n kìmbwn eÐnai 
h grafik  parˆstash thc metabol c tou pl jouc 
twn kìmbwn enìc grˆfou, ston ˆxona y, pou eqoun 
kˆpoio bajmì (se aÔxousa seirˆ), ston ˆxona x. 
To istìgramma katanom c bajm¸n kìmbwn enìc mh 
kateujunìmenou grˆfou G sqediˆzetai me thn ex c 
entol : 
hist ( deg . values (), bins = len ( set (G. degree (). values ()))) 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Sto sq ma pou akoloujeÐ blèpoume èna parˆdeigma enìc 
istogrˆmmatoc katanom c bajm¸n enìc mh kateujunìmenou grˆfou: 
'Otan o grˆfoc eÐnai kateujunìmenoc, èqoume afenìc to istìgramma 
katanom c twn exerqìmenwn bajm¸n kìmbwn kai afetèrou to 
istìgramma katanom c twn eiserqìmenwn bajm¸n kìmbwn. Oi 
tropopoi seic tou prohgoÔmenou k¸dika gia rabdogrˆmmata mh 
kateujunìmenwn grˆfwn eÐnai profaneÐc. 
Sthn epìmenh diafˆneia akoloujoÔn paradeÐgmata istogrammˆtwn 
exerqìmenwn kai eiserqìmenwn bajm¸n enìc kateujunìmenou grˆfou. 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Epiplèon, gia ènan kateujunìmeno grˆfo, mporoÔme na 
sqediˆsoume to dusdiˆstato istìgramma thc koin c 
katanom c twn exerqìmenwn kai twn eiserqìmenwn 
bajm¸n kìmbwn. 
Gia to prohgoÔmeno parˆdeigma, paÐrnoume to ex c 
dusdiˆstato istìgramma (mèsw tou k¸dika pou dÐnetai 
sto mˆjhma): 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
5 Istogrˆmmata Katanom c Bajm¸n Kìmbwn Megˆlwn 
Grˆfwn 
Tupikˆ, oi tuqaÐoi megˆloi grˆfoi Edos–Renyi 
teÐnoun na akoloujoÔn thn diwnumik  katanom , 
ìpwc faÐnetai sthn epìmenh diafˆneia gia ènan 
tuqaÐo (mh kateujunìmeno) grˆfo Edos–Renyi 5000 
kìmbwn me pijanìthta 0.25, pr¸ta se dekadikèc 
kai metˆ se logarijmikèc klÐmakec. 
Sthn perÐptwsh ìmwc twn onomazìmenwn tuqaÐwn 
grˆfwn anexart twn klÐmakac (scale–free graphs), 
oi grˆfoi autoÐ teÐnoun na akoloujoÔn thn 
katanom  tou nìmou dÔnamhc (power law distribution), 
ìpwc faÐnetai sthn mejepìmenh diafˆneia gia ènan 
tuqaÐo (mh kateujunìmeno) grˆfo Barabasi­Albert 
5000 kìmbwn me m = 3, pr¸ta se dekadikèc kai 
metˆ se logarijmikèc klÐmakec. 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Sundesimìthta 
1 Sundedemènec Sunist¸sec Mh Kateujunìmenwn 
Grˆfwn 
'Enac mh kateujunìmenoc grˆfoc lègetai 
sundedemènoc an gia kˆje duo korufèc tou upˆrqei 
mia diadrom  (path) pou tic en¸nei. Diaforetikˆ, o 
grˆfoc lègetai mh sundedemènoc. 
An ènac (mh kateujunìmenoc) grˆfoc den eÐnai 
sundedemènoc, tìte perièqei kˆpoiec (toulˆqiston 
duo) sundedemènec sunist¸sec. Mia sundedemènh 
sunist¸sa eÐnai ènac mègistoc sundedemènoc 
upogrˆfoc tou grˆfou autoÔ. 
H megalÔterh sundedemènh sunist¸sa sun jwc 
onomˆzetai gigantiaÐa sundedemènh sunist¸sa. 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Gia ènan mh kateujunìmeno grˆfo G, 
qrhsimopoioÔme tic parakˆtw entolèc gia thn 
diereÔnhsh thc sundesimìthtˆc tou (leptomèreiec 
gia to p¸c qrhsimopoioÔntoi oi entolèc autèc 
dÐnontai sto skript connectedness.py): 
nx. is_connected (G) 
nx. number_connected_components (G) 
nx. connected_components (G) 
connected_component_subgraphs (G) 
AkoloujeÐ èna parˆdeigma enìc mh sundedemènou 
(mh kateujunìmenou) tuqaÐou grˆfou me 5 
sundedemènec sunist¸sec (metaxÔ twn opoÐwn oi 2 
eÐnai apomonwmènoi kìmboi). 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
2 Isqur¸c Sundedemènec Sunist¸sec Kateujunìmenwn 
Grˆfwn 
'Enac kateujunìmenoc grˆfoc lègetai isqur¸c 
sundedemènoc an gia kˆje duo korufèc tou upˆrqei 
mia kateujunìmenh diadrom  pou tic en¸nei mèsw 
miac alusÐdac kateujunìmenwn akm¸n, oi opoÐec 
èqoun thn Ðdia forˆ kateujÔnsewn. 
An ènac (kateujunìmenoc) grˆfoc den eÐnai isqur¸c 
sundedemènoc, tìte perièqei kˆpoiec (toulˆqiston 
duo) isqur¸c sundedemènec sunist¸sec. Mia 
isqur¸c sundedemènh sunist¸sa eÐnai ènac mègistoc 
isqur¸c sundedemènoc upogrˆfoc tou grˆfou 
autoÔ. 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Gia ènan kateujunìmeno grˆfo G, qrhsimopoioÔme 
tic parakˆtw entolèc gia thn diereÔnhsh thc 
isqur c sundesimìthtˆc tou (leptomèreiec gia to 
p¸c qrhsimopoioÔntoi oi entolèc autèc dÐnontai 
sto skript connectedness.py): 
nx. is_strongly_connected (G) 
nx. number_strongly_connected_components (G) 
nx. strongly_connected_components (G) 
strongly_connected_component_subgraphs (G) 
AkoloujeÐ èna parˆdeigma enìc mh isqur¸c 
sundedemènou (kateujunìmenou) tuqaÐou grˆfou me 
3 isqur¸c sundedemènec sunist¸sec (kai qwrÐc 
apomonwmènouc kìmbouc). 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Dojèntoc enìc mh isqur¸c sundedemènou 
kateujunìmenou grˆfou G, mporoÔme na 
kataskeuˆsoume ènan grˆfo S, pou onomˆzetai 
sumpuknwmènoc grˆfoc   grˆfoc thc 
sumpÔknwshc tou G, oi kìmboi tou opoÐou eÐnai oi 
isqur¸c sundedemènec sunist¸sec tou G kai oi 
akmèc metaxÔ twn kìmbwn tou S antistoiqoÔn stic 
akmèc tou G. 
O sumpuknwmènoc grˆfoc S eÐnai profan¸c ènac 
akuklikìc kateujunìmenoc grˆfoc. 
Sthn epìmenh diafˆneia blèpoume ènan mh isqur¸c 
sundedemèno (kateujunìmeno) tuqaÐo grˆfo kai ton 
antÐstoiqo sumpuknwmèno grˆfo. O grˆfoc autìc 
èqei 2 isqur¸c sunededemènec sunist¸sec me 3 
kìmbouc, 3 me 2 kìmbouc kai 8 me 1 kìmbo. 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
3 Asjen¸c Sundedemènec Sunist¸sec Kateujunìmenwn 
Grˆfwn 
'Enac kateujunìmenoc grˆfoc lègetai asjen¸c 
sundedemènoc an gia kˆje duo korufèc tou upˆrqei 
mia diadrom  pou tic en¸nei mèsw miac alusÐdac 
akm¸n, oi opoÐec ìmwc den qreiˆzetai na èqoun thn 
Ðdia forˆ kateujÔnsewn. 
Me ˆlla lìgia, h asjen c sundesimìthta enìc 
kateujunìmenou grˆfou isodunameÐ me 
sundesimìthta, ìtan den lambˆnetai upìyh h 
kateÔjunsh twn akm¸n. 
An ènac (kateujunìmenoc) grˆfoc den eÐnai asjen¸c 
sundedemènoc, tìte perièqei kˆpoiec (toulˆqiston 
duo) asjen¸c sundedemènec sunist¸sec. Mia 
asjen¸c sundedemènh sunist¸sa eÐnai ènac mègistoc 
asjen¸c sundedemènoc upogrˆfoc tou grˆfou 
autoÔ. 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Gia ènan kateujunìmeno grˆfo G, qrhsimopoioÔme 
tic parakˆtw entolèc gia thn diereÔnhsh thc 
asjenoÔc sundesimìthtˆc tou (leptomèreiec gia to 
p¸c qrhsimopoioÔntoi oi entolèc autèc dÐnontai 
sto skript connectedness.py): 
nx. is_weakly_connected (G) 
nx. number_weakly_connected_components (G) 
nx. weakly_connected_components (G) 
weakly_connected_component_subgraphs (G) 
AkoloujeÐ èna parˆdeigma enìc mh asjen¸c 
sundedemènou (kateujunìmenou) tuqaÐou grˆfou me 
7 asjen¸c sundedemènec sunist¸sec (metaxÔ twn 
opoÐwn oi 2 eÐnai apomonwmènoi kìmboi). 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
4 Elkustikèc Sunist¸sec Kateujunìmenwn Grˆfwn 
Se ènan kateujunìmeno grˆfo, mia isqur¸c sundedemènh 
sunist¸sa onomˆzetai elkustik    elkÔousa 
sunist¸sa an kˆje kateujunìmenh diadrom  pou 
eisèrqetai mèsa se aut n thn sunist¸sa potè den 
bgaÐnei èxw apì aut n. 
Gia ènan kateujunìmeno grˆfo G, qrhsimopoioÔme tic 
parakˆtw entolèc gia thn diereÔnhsh twn elkustik¸n 
sunistws¸nc tou (leptomèreiec gia to p¸c 
qrhsimopoioÔntoi oi entolèc autèc dÐnontai sto skript 
connectedness.py): 
nx. is_attracting_component (G) 
nx. number_attracting_components (G) 
nx. attracting_components (G) 
nx. attracting_component_subgraphs (G) 
AkoloujeÐ èna parˆdeigma enìc (kateujunìmenou) 
tuqaÐou grˆfou me 2 elkustikèc sunist¸sec, ìpou 
sqediˆzetai kai o antÐstoiqoc sumpuknwmènoc grˆfoc. 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
5 Disundedemènec Sunist¸sec Mh Kateujunìmenwn 
Grˆfwn 
'Enac mh kateujunìmenoc grˆfoc onomˆzetai 
disundedemènoc (bicoonected) an den aposundèetai me 
thn apokop  opoioud pote kìmbou tou. 
Se ènan mh kateujunìmeno grˆfo, ènac mègistoc 
upogrˆfoc, pou eÐnai tètoioc ¸ste na mhn 
aposundèetai me thn apokop  opoioud pote 
kìmbou tou upogrˆfou autoÔ, onomˆzetai 
disundedemènh sunist¸sa tou grˆfou. 
'Enac kìmboc enìc mh disundedemènou grˆfou 
apoteleÐ èna shmeÐo diˆrjrwshc (articulation point)   
koruf  apokop c (cut vertex) an kai mìnon an o 
kìmboc autìc an kei se toulˆqiston duo 
disundedemènec sunist¸sec tou grˆfou autoÔ. 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Gia ènan kateujunìmeno grˆfo G, qrhsimopoioÔme 
tic parakˆtw entolèc gia thn diereÔnhsh thc 
disundesimìthtˆc tou (leptomèreiec gia to p¸c 
qrhsimopoioÔntoi oi entolèc autèc dÐnontai sto 
skript connectedness.py): 
nx. is_biconnected (G) 
nx. biconnected_component_subgraphs (G) 
nx. biconnected_component_edges (G) 
nx. articulation_points (G) 
AkoloujeÐ èna parˆdeigma enìc mh disundedemènou 
(mh kateujunìmenou) tuqaÐou grˆfou me 6 
disundedemènec sunist¸sec kai 5 shmeÐa 
diˆrjrwshc. 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
KlÐkec Kìmbwn 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Algìrijmoi BFS, DFS kai Dkstra 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Apostˆseic Kìmbwn 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
Upogrˆfoi kai IsomorfismoÐ Grˆfwn 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
3. Diktuakˆ Mètra 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
4. DiamerismoÐ Grˆfwnn 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
5. Taxinomhsimìthta – Anameiximìthta 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
6. Ekjetikˆ Montèla TuqaÐwn Grˆfwn 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
7. Qronik¸c Metaballìmenoi Grˆfoi 
Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python

Mais conteúdo relacionado

Mais procurados

Python basic
Python basic Python basic
Python basic sewoo lee
 
Diving into byte code optimization in python
Diving into byte code optimization in python Diving into byte code optimization in python
Diving into byte code optimization in python Chetan Giridhar
 
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPythonByterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPythonakaptur
 
Pycon 2011 talk (may not be final, note)
Pycon 2011 talk (may not be final, note)Pycon 2011 talk (may not be final, note)
Pycon 2011 talk (may not be final, note)c.titus.brown
 
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...akaptur
 
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 AutumnGoptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 AutumnMasashi Shibata
 
PyCon 2011 talk - ngram assembly with Bloom filters
PyCon 2011 talk - ngram assembly with Bloom filtersPyCon 2011 talk - ngram assembly with Bloom filters
PyCon 2011 talk - ngram assembly with Bloom filtersc.titus.brown
 
A Beginners Guide to Weather & Climate Data, Margriet Groenendijk
A Beginners Guide to Weather & Climate Data, Margriet GroenendijkA Beginners Guide to Weather & Climate Data, Margriet Groenendijk
A Beginners Guide to Weather & Climate Data, Margriet GroenendijkPôle Systematic Paris-Region
 
Go for the paranoid network programmer
Go for the paranoid network programmerGo for the paranoid network programmer
Go for the paranoid network programmerEleanor McHugh
 
Introdução ao Retrofit
Introdução ao Retrofit Introdução ao Retrofit
Introdução ao Retrofit Felipe Pedroso
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterakaptur
 

Mais procurados (20)

Basic Calculus in R.
Basic Calculus in R. Basic Calculus in R.
Basic Calculus in R.
 
第二讲
第二讲第二讲
第二讲
 
Python basic
Python basic Python basic
Python basic
 
Input and Output
Input and OutputInput and Output
Input and Output
 
Diving into byte code optimization in python
Diving into byte code optimization in python Diving into byte code optimization in python
Diving into byte code optimization in python
 
Let's golang
Let's golangLet's golang
Let's golang
 
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPythonByterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
 
Pycon 2011 talk (may not be final, note)
Pycon 2011 talk (may not be final, note)Pycon 2011 talk (may not be final, note)
Pycon 2011 talk (may not be final, note)
 
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
 
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 AutumnGoptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
Goptuna Distributed Bayesian Optimization Framework at Go Conference 2019 Autumn
 
PyCon 2011 talk - ngram assembly with Bloom filters
PyCon 2011 talk - ngram assembly with Bloom filtersPyCon 2011 talk - ngram assembly with Bloom filters
PyCon 2011 talk - ngram assembly with Bloom filters
 
A Beginners Guide to Weather & Climate Data, Margriet Groenendijk
A Beginners Guide to Weather & Climate Data, Margriet GroenendijkA Beginners Guide to Weather & Climate Data, Margriet Groenendijk
A Beginners Guide to Weather & Climate Data, Margriet Groenendijk
 
Slicing
SlicingSlicing
Slicing
 
Go for the paranoid network programmer
Go for the paranoid network programmerGo for the paranoid network programmer
Go for the paranoid network programmer
 
Strings
StringsStrings
Strings
 
Introdução ao Retrofit
Introdução ao Retrofit Introdução ao Retrofit
Introdução ao Retrofit
 
Python Tidbits
Python TidbitsPython Tidbits
Python Tidbits
 
Alias
AliasAlias
Alias
 
Bytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreterBytes in the Machine: Inside the CPython interpreter
Bytes in the Machine: Inside the CPython interpreter
 
Network security
Network securityNetwork security
Network security
 

Destaque

Topics of Complex Social Networks: Domination, Influence and Assortativity
Topics of Complex Social Networks: Domination, Influence and AssortativityTopics of Complex Social Networks: Domination, Influence and Assortativity
Topics of Complex Social Networks: Domination, Influence and AssortativityMoses Boudourides
 
Boudourides: Risk in Social Networks: Network Influence & Selection on Minori...
Boudourides: Risk in Social Networks: Network Influence & Selection on Minori...Boudourides: Risk in Social Networks: Network Influence & Selection on Minori...
Boudourides: Risk in Social Networks: Network Influence & Selection on Minori...Moses Boudourides
 
Δίκτυα Λογοτεχνίας: Μια Πρώτη Εισαγωγική Προσέγγιση
Δίκτυα Λογοτεχνίας: Μια Πρώτη Εισαγωγική ΠροσέγγισηΔίκτυα Λογοτεχνίας: Μια Πρώτη Εισαγωγική Προσέγγιση
Δίκτυα Λογοτεχνίας: Μια Πρώτη Εισαγωγική ΠροσέγγισηMoses Boudourides
 
Πρότζεκτ για δίκτυα του LinkedIn με την Python
Πρότζεκτ για δίκτυα του LinkedIn με την PythonΠρότζεκτ για δίκτυα του LinkedIn με την Python
Πρότζεκτ για δίκτυα του LinkedIn με την PythonMoses Boudourides
 
Μαθαίνοντας την R σε μια ώρα
Μαθαίνοντας την R σε μια ώραΜαθαίνοντας την R σε μια ώρα
Μαθαίνοντας την R σε μια ώραMoses Boudourides
 
Πανεπιστήμιο και Κοινωνία των Πολιτών: Στοιχεία & Περιπτώσεις Αποικιοποίησ...
Πανεπιστήμιο και Κοινωνία των Πολιτών: Στοιχεία & Περιπτώσεις Αποικιοποίησ...Πανεπιστήμιο και Κοινωνία των Πολιτών: Στοιχεία & Περιπτώσεις Αποικιοποίησ...
Πανεπιστήμιο και Κοινωνία των Πολιτών: Στοιχεία & Περιπτώσεις Αποικιοποίησ...Moses Boudourides
 
Dominating Sets, Multiple Egocentric Networks and Modularity Maximizing Clust...
Dominating Sets, Multiple Egocentric Networks and Modularity Maximizing Clust...Dominating Sets, Multiple Egocentric Networks and Modularity Maximizing Clust...
Dominating Sets, Multiple Egocentric Networks and Modularity Maximizing Clust...Moses Boudourides
 
Διακριτά Μαθηματικά Ι: Εισαγωγή στη Λογική. Του Μωυσή Μπουντουρίδη
Διακριτά Μαθηματικά Ι: Εισαγωγή στη Λογική. Του Μωυσή ΜπουντουρίδηΔιακριτά Μαθηματικά Ι: Εισαγωγή στη Λογική. Του Μωυσή Μπουντουρίδη
Διακριτά Μαθηματικά Ι: Εισαγωγή στη Λογική. Του Μωυσή ΜπουντουρίδηMoses Boudourides
 
Extended Cyclic Cellular Automata: Emulating Social Influence. By Moses A. Bo...
Extended Cyclic Cellular Automata: Emulating Social Influence. By Moses A. Bo...Extended Cyclic Cellular Automata: Emulating Social Influence. By Moses A. Bo...
Extended Cyclic Cellular Automata: Emulating Social Influence. By Moses A. Bo...Moses Boudourides
 
Διακριτά Μαθηματικά ΙI: Εισαγωγή στη Συνδυαστική. Του Μωυσή Μπουντουρίδη
Διακριτά Μαθηματικά ΙI: Εισαγωγή στη Συνδυαστική. Του Μωυσή ΜπουντουρίδηΔιακριτά Μαθηματικά ΙI: Εισαγωγή στη Συνδυαστική. Του Μωυσή Μπουντουρίδη
Διακριτά Μαθηματικά ΙI: Εισαγωγή στη Συνδυαστική. Του Μωυσή ΜπουντουρίδηMoses Boudourides
 
Demo and Review of OpenID poster presentation
Demo and Review of OpenID poster presentationDemo and Review of OpenID poster presentation
Demo and Review of OpenID poster presentationstonehz
 
Network Approaches for Interbank Markets
Network Approaches for Interbank MarketsNetwork Approaches for Interbank Markets
Network Approaches for Interbank MarketsKimmo Soramaki
 
Digital, Humanities, Latour and Networks. By Moses A. Boudourides
Digital, Humanities, Latour and Networks. By Moses A. BoudouridesDigital, Humanities, Latour and Networks. By Moses A. Boudourides
Digital, Humanities, Latour and Networks. By Moses A. BoudouridesMoses Boudourides
 
Global Network of Payment Flows - Presentation at Commerzbank Cash Forum
Global Network of Payment Flows - Presentation at Commerzbank Cash ForumGlobal Network of Payment Flows - Presentation at Commerzbank Cash Forum
Global Network of Payment Flows - Presentation at Commerzbank Cash ForumKimmo Soramaki
 
Goo Create: Import animation
Goo Create: Import animationGoo Create: Import animation
Goo Create: Import animationGoo Technologies
 
Goo Create: Import and Create
Goo Create: Import and CreateGoo Create: Import and Create
Goo Create: Import and CreateGoo Technologies
 
Art 2100 Online syllabus summer i 2016
Art 2100 Online syllabus summer i 2016Art 2100 Online syllabus summer i 2016
Art 2100 Online syllabus summer i 2016Lydia Dorsey
 

Destaque (20)

Topics of Complex Social Networks: Domination, Influence and Assortativity
Topics of Complex Social Networks: Domination, Influence and AssortativityTopics of Complex Social Networks: Domination, Influence and Assortativity
Topics of Complex Social Networks: Domination, Influence and Assortativity
 
Boudourides: Risk in Social Networks: Network Influence & Selection on Minori...
Boudourides: Risk in Social Networks: Network Influence & Selection on Minori...Boudourides: Risk in Social Networks: Network Influence & Selection on Minori...
Boudourides: Risk in Social Networks: Network Influence & Selection on Minori...
 
Δίκτυα Λογοτεχνίας: Μια Πρώτη Εισαγωγική Προσέγγιση
Δίκτυα Λογοτεχνίας: Μια Πρώτη Εισαγωγική ΠροσέγγισηΔίκτυα Λογοτεχνίας: Μια Πρώτη Εισαγωγική Προσέγγιση
Δίκτυα Λογοτεχνίας: Μια Πρώτη Εισαγωγική Προσέγγιση
 
Πρότζεκτ για δίκτυα του LinkedIn με την Python
Πρότζεκτ για δίκτυα του LinkedIn με την PythonΠρότζεκτ για δίκτυα του LinkedIn με την Python
Πρότζεκτ για δίκτυα του LinkedIn με την Python
 
Μαθαίνοντας την R σε μια ώρα
Μαθαίνοντας την R σε μια ώραΜαθαίνοντας την R σε μια ώρα
Μαθαίνοντας την R σε μια ώρα
 
Πανεπιστήμιο και Κοινωνία των Πολιτών: Στοιχεία & Περιπτώσεις Αποικιοποίησ...
Πανεπιστήμιο και Κοινωνία των Πολιτών: Στοιχεία & Περιπτώσεις Αποικιοποίησ...Πανεπιστήμιο και Κοινωνία των Πολιτών: Στοιχεία & Περιπτώσεις Αποικιοποίησ...
Πανεπιστήμιο και Κοινωνία των Πολιτών: Στοιχεία & Περιπτώσεις Αποικιοποίησ...
 
Dominating Sets, Multiple Egocentric Networks and Modularity Maximizing Clust...
Dominating Sets, Multiple Egocentric Networks and Modularity Maximizing Clust...Dominating Sets, Multiple Egocentric Networks and Modularity Maximizing Clust...
Dominating Sets, Multiple Egocentric Networks and Modularity Maximizing Clust...
 
Διακριτά Μαθηματικά Ι: Εισαγωγή στη Λογική. Του Μωυσή Μπουντουρίδη
Διακριτά Μαθηματικά Ι: Εισαγωγή στη Λογική. Του Μωυσή ΜπουντουρίδηΔιακριτά Μαθηματικά Ι: Εισαγωγή στη Λογική. Του Μωυσή Μπουντουρίδη
Διακριτά Μαθηματικά Ι: Εισαγωγή στη Λογική. Του Μωυσή Μπουντουρίδη
 
Extended Cyclic Cellular Automata: Emulating Social Influence. By Moses A. Bo...
Extended Cyclic Cellular Automata: Emulating Social Influence. By Moses A. Bo...Extended Cyclic Cellular Automata: Emulating Social Influence. By Moses A. Bo...
Extended Cyclic Cellular Automata: Emulating Social Influence. By Moses A. Bo...
 
Διακριτά Μαθηματικά ΙI: Εισαγωγή στη Συνδυαστική. Του Μωυσή Μπουντουρίδη
Διακριτά Μαθηματικά ΙI: Εισαγωγή στη Συνδυαστική. Του Μωυσή ΜπουντουρίδηΔιακριτά Μαθηματικά ΙI: Εισαγωγή στη Συνδυαστική. Του Μωυσή Μπουντουρίδη
Διακριτά Μαθηματικά ΙI: Εισαγωγή στη Συνδυαστική. Του Μωυσή Μπουντουρίδη
 
Εισαγωγή στη Θεωρία Κοινωνικών Δικτύων
Εισαγωγή στη Θεωρία Κοινωνικών ΔικτύωνΕισαγωγή στη Θεωρία Κοινωνικών Δικτύων
Εισαγωγή στη Θεωρία Κοινωνικών Δικτύων
 
Demo and Review of OpenID poster presentation
Demo and Review of OpenID poster presentationDemo and Review of OpenID poster presentation
Demo and Review of OpenID poster presentation
 
Network Approaches for Interbank Markets
Network Approaches for Interbank MarketsNetwork Approaches for Interbank Markets
Network Approaches for Interbank Markets
 
Python networkx library quick start guide
Python networkx library quick start guidePython networkx library quick start guide
Python networkx library quick start guide
 
Digital, Humanities, Latour and Networks. By Moses A. Boudourides
Digital, Humanities, Latour and Networks. By Moses A. BoudouridesDigital, Humanities, Latour and Networks. By Moses A. Boudourides
Digital, Humanities, Latour and Networks. By Moses A. Boudourides
 
Global Network of Payment Flows - Presentation at Commerzbank Cash Forum
Global Network of Payment Flows - Presentation at Commerzbank Cash ForumGlobal Network of Payment Flows - Presentation at Commerzbank Cash Forum
Global Network of Payment Flows - Presentation at Commerzbank Cash Forum
 
Goo Create: Import animation
Goo Create: Import animationGoo Create: Import animation
Goo Create: Import animation
 
French vocab rehab
French vocab rehabFrench vocab rehab
French vocab rehab
 
Goo Create: Import and Create
Goo Create: Import and CreateGoo Create: Import and Create
Goo Create: Import and Create
 
Art 2100 Online syllabus summer i 2016
Art 2100 Online syllabus summer i 2016Art 2100 Online syllabus summer i 2016
Art 2100 Online syllabus summer i 2016
 

Semelhante a Slides Δικτυακών Υπολογισμών με την Python

Python for Scientific Computing -- Ricardo Cruz
Python for Scientific Computing -- Ricardo CruzPython for Scientific Computing -- Ricardo Cruz
Python for Scientific Computing -- Ricardo Cruzrpmcruz
 
DSD-INT 2018 Work with iMOD MODFLOW models in Python - Visser Bootsma
DSD-INT 2018 Work with iMOD MODFLOW models in Python - Visser BootsmaDSD-INT 2018 Work with iMOD MODFLOW models in Python - Visser Bootsma
DSD-INT 2018 Work with iMOD MODFLOW models in Python - Visser BootsmaDeltares
 
Pig: Data Analysis Tool in Cloud
Pig: Data Analysis Tool in Cloud Pig: Data Analysis Tool in Cloud
Pig: Data Analysis Tool in Cloud Jianfeng Zhang
 
PyParis - weather and climate data
PyParis - weather and climate dataPyParis - weather and climate data
PyParis - weather and climate dataMargriet Groenendijk
 
Array matrix example programs - C language
Array matrix example programs - C languageArray matrix example programs - C language
Array matrix example programs - C languageSk_Group
 
Javasccript MV* frameworks
Javasccript MV* frameworksJavasccript MV* frameworks
Javasccript MV* frameworksKerry Buckley
 
Getting more out of Matplotlib with GR
Getting more out of Matplotlib with GRGetting more out of Matplotlib with GR
Getting more out of Matplotlib with GRJosef Heinen
 
Security of Artificial Intelligence
Security of Artificial IntelligenceSecurity of Artificial Intelligence
Security of Artificial IntelligenceFederico Cerutti
 
Regression and Classification with R
Regression and Classification with RRegression and Classification with R
Regression and Classification with RYanchang Zhao
 
Simple APIs and innovative documentation
Simple APIs and innovative documentationSimple APIs and innovative documentation
Simple APIs and innovative documentationPyDataParis
 
A gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojureA gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojurePaul Lam
 
Speaker Diarization
Speaker DiarizationSpeaker Diarization
Speaker DiarizationHONGJOO LEE
 
Threading Is Not A Model
Threading Is Not A ModelThreading Is Not A Model
Threading Is Not A Modelguest2a5acfb
 
Statistical inference for (Python) Data Analysis. An introduction.
Statistical inference for (Python) Data Analysis. An introduction.Statistical inference for (Python) Data Analysis. An introduction.
Statistical inference for (Python) Data Analysis. An introduction.Piotr Milanowski
 

Semelhante a Slides Δικτυακών Υπολογισμών με την Python (20)

Python grass
Python grassPython grass
Python grass
 
Python for Scientific Computing -- Ricardo Cruz
Python for Scientific Computing -- Ricardo CruzPython for Scientific Computing -- Ricardo Cruz
Python for Scientific Computing -- Ricardo Cruz
 
Triggering patterns of topology changes in dynamic attributed graphs
Triggering patterns of topology changes in dynamic attributed graphsTriggering patterns of topology changes in dynamic attributed graphs
Triggering patterns of topology changes in dynamic attributed graphs
 
Pythonic Math
Pythonic MathPythonic Math
Pythonic Math
 
DSD-INT 2018 Work with iMOD MODFLOW models in Python - Visser Bootsma
DSD-INT 2018 Work with iMOD MODFLOW models in Python - Visser BootsmaDSD-INT 2018 Work with iMOD MODFLOW models in Python - Visser Bootsma
DSD-INT 2018 Work with iMOD MODFLOW models in Python - Visser Bootsma
 
Pig: Data Analysis Tool in Cloud
Pig: Data Analysis Tool in Cloud Pig: Data Analysis Tool in Cloud
Pig: Data Analysis Tool in Cloud
 
PyParis - weather and climate data
PyParis - weather and climate dataPyParis - weather and climate data
PyParis - weather and climate data
 
Warna rgb
Warna rgbWarna rgb
Warna rgb
 
Array matrix example programs - C language
Array matrix example programs - C languageArray matrix example programs - C language
Array matrix example programs - C language
 
Javasccript MV* frameworks
Javasccript MV* frameworksJavasccript MV* frameworks
Javasccript MV* frameworks
 
K031065069
K031065069K031065069
K031065069
 
Getting more out of Matplotlib with GR
Getting more out of Matplotlib with GRGetting more out of Matplotlib with GR
Getting more out of Matplotlib with GR
 
Security of Artificial Intelligence
Security of Artificial IntelligenceSecurity of Artificial Intelligence
Security of Artificial Intelligence
 
Regression and Classification with R
Regression and Classification with RRegression and Classification with R
Regression and Classification with R
 
Simple APIs and innovative documentation
Simple APIs and innovative documentationSimple APIs and innovative documentation
Simple APIs and innovative documentation
 
A gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojureA gentle introduction to functional programming through music and clojure
A gentle introduction to functional programming through music and clojure
 
Speaker Diarization
Speaker DiarizationSpeaker Diarization
Speaker Diarization
 
Threading Is Not A Model
Threading Is Not A ModelThreading Is Not A Model
Threading Is Not A Model
 
Statistical inference for (Python) Data Analysis. An introduction.
Statistical inference for (Python) Data Analysis. An introduction.Statistical inference for (Python) Data Analysis. An introduction.
Statistical inference for (Python) Data Analysis. An introduction.
 
Revision1schema C programming
Revision1schema C programmingRevision1schema C programming
Revision1schema C programming
 

Mais de Moses Boudourides

A bibliometric study on the literature of Open Science and Open Access. By Ts...
A bibliometric study on the literature of Open Science and Open Access. By Ts...A bibliometric study on the literature of Open Science and Open Access. By Ts...
A bibliometric study on the literature of Open Science and Open Access. By Ts...Moses Boudourides
 
Boudourides: Analysis of Bibliometric Data of Publications on “Computational ...
Boudourides: Analysis of Bibliometric Data of Publications on “Computational ...Boudourides: Analysis of Bibliometric Data of Publications on “Computational ...
Boudourides: Analysis of Bibliometric Data of Publications on “Computational ...Moses Boudourides
 
Closures and Attributes in Graphs: Shadows of (Dis)Assembled Networks. By Mos...
Closures and Attributes in Graphs: Shadows of (Dis)Assembled Networks. By Mos...Closures and Attributes in Graphs: Shadows of (Dis)Assembled Networks. By Mos...
Closures and Attributes in Graphs: Shadows of (Dis)Assembled Networks. By Mos...Moses Boudourides
 
Experiments of Friedkin–Johnsen Social Influence on Graphs
Experiments of Friedkin–Johnsen Social Influence on GraphsExperiments of Friedkin–Johnsen Social Influence on Graphs
Experiments of Friedkin–Johnsen Social Influence on GraphsMoses Boudourides
 
Transitions and Trajectories in Temporal Networks
Transitions and Trajectories in Temporal NetworksTransitions and Trajectories in Temporal Networks
Transitions and Trajectories in Temporal NetworksMoses Boudourides
 
Multilayerity within multilayerity? On multilayer assortativity in social net...
Multilayerity within multilayerity? On multilayer assortativity in social net...Multilayerity within multilayerity? On multilayer assortativity in social net...
Multilayerity within multilayerity? On multilayer assortativity in social net...Moses Boudourides
 
Boudourides & Lenis, Distribution of Groups of Vertices Across Multilayer Net...
Boudourides & Lenis, Distribution of Groups of Vertices Across Multilayer Net...Boudourides & Lenis, Distribution of Groups of Vertices Across Multilayer Net...
Boudourides & Lenis, Distribution of Groups of Vertices Across Multilayer Net...Moses Boudourides
 
Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...
Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...
Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...Moses Boudourides
 
Η Επιστήμη των Δικτύων: Μια Πολύ Σύντομη Εισαγωγική Παρουσίαση - 8 Οκτωβρίου ...
Η Επιστήμη των Δικτύων: Μια Πολύ Σύντομη Εισαγωγική Παρουσίαση - 8 Οκτωβρίου ...Η Επιστήμη των Δικτύων: Μια Πολύ Σύντομη Εισαγωγική Παρουσίαση - 8 Οκτωβρίου ...
Η Επιστήμη των Δικτύων: Μια Πολύ Σύντομη Εισαγωγική Παρουσίαση - 8 Οκτωβρίου ...Moses Boudourides
 
Short version of Dominating Sets, Multiple Egocentric Networks and Modularity...
Short version of Dominating Sets, Multiple Egocentric Networks and Modularity...Short version of Dominating Sets, Multiple Egocentric Networks and Modularity...
Short version of Dominating Sets, Multiple Egocentric Networks and Modularity...Moses Boudourides
 
The hidden rules and open secrets of corporate governance. Preliminary result...
The hidden rules and open secrets of corporate governance. Preliminary result...The hidden rules and open secrets of corporate governance. Preliminary result...
The hidden rules and open secrets of corporate governance. Preliminary result...Moses Boudourides
 

Mais de Moses Boudourides (11)

A bibliometric study on the literature of Open Science and Open Access. By Ts...
A bibliometric study on the literature of Open Science and Open Access. By Ts...A bibliometric study on the literature of Open Science and Open Access. By Ts...
A bibliometric study on the literature of Open Science and Open Access. By Ts...
 
Boudourides: Analysis of Bibliometric Data of Publications on “Computational ...
Boudourides: Analysis of Bibliometric Data of Publications on “Computational ...Boudourides: Analysis of Bibliometric Data of Publications on “Computational ...
Boudourides: Analysis of Bibliometric Data of Publications on “Computational ...
 
Closures and Attributes in Graphs: Shadows of (Dis)Assembled Networks. By Mos...
Closures and Attributes in Graphs: Shadows of (Dis)Assembled Networks. By Mos...Closures and Attributes in Graphs: Shadows of (Dis)Assembled Networks. By Mos...
Closures and Attributes in Graphs: Shadows of (Dis)Assembled Networks. By Mos...
 
Experiments of Friedkin–Johnsen Social Influence on Graphs
Experiments of Friedkin–Johnsen Social Influence on GraphsExperiments of Friedkin–Johnsen Social Influence on Graphs
Experiments of Friedkin–Johnsen Social Influence on Graphs
 
Transitions and Trajectories in Temporal Networks
Transitions and Trajectories in Temporal NetworksTransitions and Trajectories in Temporal Networks
Transitions and Trajectories in Temporal Networks
 
Multilayerity within multilayerity? On multilayer assortativity in social net...
Multilayerity within multilayerity? On multilayer assortativity in social net...Multilayerity within multilayerity? On multilayer assortativity in social net...
Multilayerity within multilayerity? On multilayer assortativity in social net...
 
Boudourides & Lenis, Distribution of Groups of Vertices Across Multilayer Net...
Boudourides & Lenis, Distribution of Groups of Vertices Across Multilayer Net...Boudourides & Lenis, Distribution of Groups of Vertices Across Multilayer Net...
Boudourides & Lenis, Distribution of Groups of Vertices Across Multilayer Net...
 
Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...
Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...
Boudourides et al., Transitions and Trajectories in Temporal Networks with Ov...
 
Η Επιστήμη των Δικτύων: Μια Πολύ Σύντομη Εισαγωγική Παρουσίαση - 8 Οκτωβρίου ...
Η Επιστήμη των Δικτύων: Μια Πολύ Σύντομη Εισαγωγική Παρουσίαση - 8 Οκτωβρίου ...Η Επιστήμη των Δικτύων: Μια Πολύ Σύντομη Εισαγωγική Παρουσίαση - 8 Οκτωβρίου ...
Η Επιστήμη των Δικτύων: Μια Πολύ Σύντομη Εισαγωγική Παρουσίαση - 8 Οκτωβρίου ...
 
Short version of Dominating Sets, Multiple Egocentric Networks and Modularity...
Short version of Dominating Sets, Multiple Egocentric Networks and Modularity...Short version of Dominating Sets, Multiple Egocentric Networks and Modularity...
Short version of Dominating Sets, Multiple Egocentric Networks and Modularity...
 
The hidden rules and open secrets of corporate governance. Preliminary result...
The hidden rules and open secrets of corporate governance. Preliminary result...The hidden rules and open secrets of corporate governance. Preliminary result...
The hidden rules and open secrets of corporate governance. Preliminary result...
 

Último

Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 

Último (20)

Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 

Slides Δικτυακών Υπολογισμών με την Python

  • 1. DiktuakoÐ UpologismoÐ me thn Python Mwus c A. MpountourÐdhc Tm ma Majhmatik¸n PanepisthmÐou Pˆtrac mboudour@upatras.gr Okt¸brioc–Dekèmbrioc 2014 Last update: 3–12–2014 Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 2. Perieqìmena 1. Eisagwg  Grˆfwn 2. BasikoÐ UpologismoÐ thc JewrÐac Grˆfwn 3. Diktuakˆ Mètra 4. DiamerismoÐ Grˆfwn 5. Taxinomhsimìthta – Anameiximìthta 6. Ekjetikˆ Montèla TuqaÐwn Grˆfwn 7. Qronik¸c Metaballìmenoi Grˆfoi Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 3. 1. Eisagwg  Grˆfwn Egkatˆstash tou NetworkX Eisagwg  (Mh Kateujunìmenwn) Grˆfwn AploÐ Grˆfoi PollaploÐ Grˆfoi Eisagwg  Kateujunìmenwn Grˆfwn AploÐ Kateujunìmenoi Grˆfoi PollaploÐ Kateujunìmenoi Grˆfoi Eisagwg  Grˆfwn me Bˆrh Akm¸n Eisagwg  Dimer¸n Grˆfwn Qarakthristikˆ (Attributes) Kìmbwn kai Akm¸n Genn torec Prokataskeuasmènwn Grˆfwn OptikopoÐhsh (Visualization) Grˆfwn me to Gephi DiepÐpedoi Grˆfoi Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 4. Egkatˆstash tou NetworkX To NetworkX eÐnai èna pakèto thc Python gia thn dhmiourgÐa, thn diaqeÐrish kai ulopoÐhsh upologism¸n gia grˆfouc kai dÐktua. To NetworkX diatÐjetai gia katèbasma (mazÐ me odhgÐec egkatˆstashc) gia ìla ta leitourgikˆ sust mata apì to Python Package Index (pypi) sto http://pypi.python.org/pypi/networkx. Efìson eÐnai egkatasthmènoc o python package manager pip, tìte to NetworkX mporeÐ na egkatastajeÐ autìmata mèsw thc (exwterik c sthn Python) entol c: pip install networkx Mèsa sto peribˆllon thc Python, to NetworkX kaleÐtai (eisˆgetai) wc ex c: import networkx as nx Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 5. Eisagwg  AploÔ (Mh Kateujunìmenou) Grˆfou Pr¸ta, dÐnontai oi entolèc gia mh kateujunìmenouc grˆfouc. Arqikˆ, dhmiourgeÐtai ènac kenìc grˆfoc: import networkx as nx G = nx. Graph () Metˆ, eisˆgontai arqikˆ oi kìmboi, p.q., oi 5 kìmboi '1', '2', '3', '4' kai '5' mpaÐnoun wc ex c: G. add_nodes_from ([1,2,3,4,5]) Bèbaia, antÐ gia arijmoÔc, oi kìmboi mporoÔn na eisˆgontai wc onìmata   lèxeic, p.q.: G. add_nodes_from ([ 'John ', 'Mary ']) G. add_node (" London ") G. add_nodes_from ([ 'a','b','c','d','e']) Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 6. Gia na doÔme ìlouc touc kìmbouc pou èqoun mpei wc t¸ra kai na afairèsoume kˆpoiouc   ìlouc: G. nodes () G. remove_nodes_from ([ 'John ', 'Mary ']) G. clear () Sth sunèqeia, eisˆgontai oi akmèc, p.q., gia touc 5 kìmbouc 1–5 (pou prèpei na epana–eisaqjoÔn), na 6 sundèseic: G. add_nodes_from ([1,2,3,4,5]) G. add_edges_from ([(1,2),(1,4),(2,3),(3,4),(3,5),(4,5 )]) Oi lÐstec kai to pl joc twn eisaqjèntwn kìmbwn kai akm¸n dÐnontai apì tic entolèc: G. nodes () G. number_of_nodes () G. edges () G. number_of_edges () Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 7. Gia to sqediasmì tou eisaqjèntoc grˆfou, p.q, tou paradeÐgmatoc autoÔ tou grˆfou me 5 kìmbouc kai 6 akmèc, ekteloÔntai oi entolèc: import matplotlib . pyplot as plt plt . figure () nx. draw (G, with_labels = True ) plt . show () H teleutaÐa entol  dèqetai diˆforec paramètrouc, ìpwc, p.q., gia diaforetikì tÔpo sqedÐou (layout), mègejoc kai qr¸ma kìmbwn kai afaÐresh twn onomˆtwn (ids) twn kìmbwn: nx. draw_spring (G, node_size =100 , node_color ='# A0CBE2 ', with_labels = False ) Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 8. ParaleÐpontac tic prohgoÔmenec parametropoi seic, o sqediasmìc tou grˆfou tou paradeÐgmatoc dÐnei to diˆgramma: Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 9. Oi kìmboi mporoÔn na topotethjoÔn se stajerèc (prokajorismènec) jèseic, efìson o grˆfoc eÐqe eisaqjeÐ me tic suntetagmènec touc, pou mporeÐ na gÐnei, p.q., sto parˆdeigma autì wc ex c: pos ={1:(0,0),2:(1,0),4:(0,1),3:(1,1),5:(0.5,2.0)} plt . figure () nx. draw (G,pos , with_labels = True ) plt . show () Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 10. Eisagwg  PollaploÔ (Mh Kateujunìmenou) Grˆfou 'Enac pollaplìc grˆfoc (multigraph) eÐnai ènac grˆfoc me pollaplèc (parˆllhlec) akmèc kai (endeqomènwc) kai auto–brìgqouc (self–loops). Na èna parˆdeigma pollaploÔ (mh kateujunìmenou) grˆfou: 3 1 2 O grˆfoc autìc eisˆgetai wc ex c (allˆ den eÐnai dunatì na sqediasjeÐ me to NetworkX): G = nx. MultiGraph () G. add_nodes_from ( range (1,4)) G. add_edges_from ([(1,2),(1,2),(1,2),(1,3),(2,2),(2,3),(2,3 )]) Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 11. Eisagwg  AploÔ Kateujunìmenou Grˆfou GÐnetai wc ex c, p.q., sto parˆdeigma autì: G=nx. DiGraph () G. add_nodes_from (["A","B","C","D"]) G. add_edges_from ([( "A","B"), ("C","A"), ("C","B"), ("B","D")]) Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 12. Eisagwg  PollaploÔ Kateujunìmenou Grˆfou Na èna parˆdeigma pollaploÔ kateujunìmenou grˆfou: 3 1 2 O grˆfoc autìc eisˆgetai wc ex c (allˆ den eÐnai dunatì na sqediasjeÐ me to NetworkX): G = nx. MultiDiGraph () G. add_nodes_from ( range (1,4)) G. add_edges_from ([(1,2),(1,2),(2,1),(1,3),(2,2),(2,3),(3,2 )]) Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 13. Eisagwg  Grˆfwn me Bˆrh Akm¸n GÐnetai, p.q., sto parˆdeigma autì me tic entolèc: G=nx. Graph () G. add_weighted_edges_from ([( 'a','b',4),( 'a','c',8), ('a','d',5),( 'c','d',3)]) kai o sqediasmìc wc ex c: plt . figure ( facecolor ='w') pos =nx. spring_layout (G) edge_labels = dict ([((u,v ,),d['weight ']) for u,v,d in G. edges ( data = True )]) nx. draw_networkx_nodes (G,pos , node_size = 700) nx. draw_networkx_edges (G, pos) nx. draw_networkx_labels (G,pos , font_size =20) nx. draw_networkx_edge_labels (G,pos , edge_labels = edge_labels , font_size =20) plt . axis ('off ') plt . show () Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 14. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 15. AntÐ thc parˆjeshc twn tim¸n twn bar¸n, oi akmèc mporoÔn na sqediasjoÔn me eÔrh anˆloga twn tim¸n twn bar¸n wc ex c: plt . figure ( facecolor ='w') nx. draw_networkx_nodes (G,pos , node_size = 700) edgewidth =[] for (u,v,d) in G. edges ( data = True ): edgewidth . append (d['weight ']) nx. draw_networkx_edges (G,pos , edge_color ='b', width = edgewidth ) nx. draw_networkx_labels (G,pos , font_size =20) plt . axis ('off ') plt . show () Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 16. Epiplèon, mporoÔn na krathjoÔn sto sqèdio mìno oi akmèc me bˆrh megalÔtera kˆpoiac endiˆmeshc tim c, p.q., 4: elarge = [(u,v) for (u,v,d) in G. edges ( data = True ) if d['weight '] >4] esmall = [(u,v) for (u,v,d) in G. edges ( data = True ) if d['weight '] <=4] plt . figure ( facecolor ='w') nx. draw_networkx_nodes (G,pos , node_size = 700) nx. draw_networkx_edges (G,pos , edgelist = elarge , edge_color ='b',width = edgewidth ) nx. draw_networkx_edges (G,pos , edgelist = esmall , width =6, alpha =0.5, edge_color ='g',style ='dashed ') nx. draw_networkx_labels (G,pos , font_size =20) plt . axis ('off ') plt . show () Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 17. Eisagwg  Dimer¸n Grˆfwn H eisagwg  dimer¸n grˆfwn gÐnetai ìpwc, p.q., sto parakˆtw parˆdeigma: from networkx . algorithms import bipartite G = nx. Graph () G. add_nodes_from ([1,2,3,4], bipartite =0) G. add_nodes_from ([ 'a','b','c'], bipartite =1) G. add_edges_from ([(1,'a'),(1,'b'),(2,'a'),(2,'b'), (2,'c'),(3,'c'),(4,'b'),(4,'c')]) pos ={1:(0,0), 2:(0,1), 3:(0,2), 4:(0,3), 'a':(1,0.5), 'b':(1,1.5), 'c':(1,2.5)} O èlegqoc an prìkeitai perÐ dimeroÔc grˆfou (True)   ìqi (False) gÐnetai me thn entol : print bipartite . is_bipartite (G) % True Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 18. O sqediasmìc tou dimeroÔc grˆfou gÐnetai wc ex c: mode1 , mode2 = bipartite . sets (G) plt . figure ( facecolor ='w') nx. draw_networkx_nodes (G,pos , nodelist = list ( mode1 ), node_color ='b',node_size = 700) nx. draw_networkx_nodes (G,pos , nodelist = list ( mode2 ), node_color ='g',node_size = 700) nx. draw_networkx_edges (G, pos) nx. draw_networkx_labels (G,pos , font_size =20 , font_color ='# FFFFFF ') plt . axis ('off ') plt . show () Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 19. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 20. Qarakthristikˆ (Attributes) Kìmbwn kai Akm¸n Ta qarakthristikˆ twn kìmbwn mpaÐnoun wc ex c (sto parˆdeigma autì gia to qarakthristikì tou qr¸matoc): G = nx. Graph () G. add_node (1, color ='red ') G. add_node (2, color ='blue ') G. add_node (3, color ='green ') G. add_edges_from ([(1,2),(1,3),(2,3 )]) G. node [1] G. node [1][ 'color '] G. nodes ( data = True ) G. add_nodes_from ([(1, {'color ': 'red '}), (2, {'color ': 'blue '}), (3, {'color ': 'green '} )]) custom_node_color ={} custom_node_color [1] = 'r' custom_node_color [2] = 'b' custom_node_color [3] = 'g' plt . figure () nx. draw (G, node_list = custom_node_color . keys (), node_color = custom_node_color . values ()) plt . show () Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 21. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 22. Ta qarakthristikˆ twn akm¸n mpaÐnoun wc ex c (sto parˆdeigma autì gia to qarakthristikì tou qrìnou): G = nx. Graph () G. add_edge (1, 2, time ='May ') G. add_edge (2, 3, time ='June ') G. add_edge (3, 4, time ='July ') G. add_edge (4, 1, time ='August ') G. edge [1][2] G. edge [1][2][ 'time '] G. edges ( data = True ) G. add_edges_from ([(1, 2, {'time ': 'May '}), (1, 4, {'time ': 'August '}), (2, 3, {'time ': 'June '}), (3, 4, {'time ': 'July '} )]) edgelist = [(1,2),(2,3),(3,4),(1,4)] colorlist =[ 'r','b','g','k'] pos =nx. spring_layout (G) plt . figure ( facecolor ='w') nx. draw_networkx_nodes (G,pos , with_labels = True ) nx. draw_networkx_labels (G,pos , font_size =10) nx. draw_networkx_edges (G,pos , edgelist = edgelist , edge_color = colorlist ) plt . axis ('off ') plt . show () Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 23. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 24. Genn torec Prokataskeuasmènwn Grˆfwn Oi prokajorismènoi grˆfoi eisˆgontai wc G = nx.graph - name ( parameters ) ìpou to "ìnoma–grˆfou" kai oi "parˆmetroi’’ eÐnai ìpwc dÐnontai sth sunèqeia. Gia ton sqediasmì twn prokajorismènwn grˆfwn (qwrÐc parametropoi seic) oi entolèc eÐnai: plt . figure () nx. draw (G, with_labels = False ) plt . show () Perissìteroi prokataskeuasmènoi grˆfoi tou NetworkX dÐnontai sth selÐda: https://networkx.github.io/documentation/latest/reference/generators.html Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 25. 1 AploÐ kai GnwstoÐ Prokataskeuasmènoi Grˆfoi KÔkloc n kìmbwn: cycle_graph (n) Astèri n + 1 kìmbwn: star_graph (n) Diadrom  n kìmbwn: path_graph (n) Grˆfoc aetoÔ tou Krackhardt: krackhardt_kite_graph () Grˆfoc Flwrentian¸n oikogenei¸n: florentine_families_graph () Grˆfoc tou karˆte klamp: karate_club_graph () Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 26. K¸dikac gia ton sqediasmì twn epìmenwn diktÔwn: G1 = nx. cycle_graph (10) G2 = nx. star_graph (6) G3 = nx. path_graph (6) G4 = nx. krackhardt_kite_graph () G5 = nx. florentine_families_graph () G6 = nx. karate_club_graph () fig = plt . figure ( figsize =(10 ,10 )) plt . subplot (2,3,1). set_title (" Cycle ") nx. draw (G1 , node_size =40 , with_labels = False ); plt . axis (" tight ") plt . subplot (2,3,2). set_title (" Star ") nx. draw (G2 , node_size =40 , with_labels = False ); plt . axis (" tight ") plt . subplot (2,3,3). set_title (" Path ") nx. draw (G3 , node_size =40 , with_labels = False ); plt . axis (" tight ") plt . subplot (2,3,4). set_title (" Krackhardt kite ") nx. draw (G4 , node_size =40 , with_labels = False ); plt . axis (" tight ") plt . subplot (2,3,5). set_title (" Florentine families ") nx. draw (G5 , node_size =40 , with_labels = False ); plt . axis (" tight ") plt . subplot (2,3,6). set_title (" Karate club ") nx. draw (G6 , node_size =40 , with_labels = False ); plt . axis (" tight ") plt . show () Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 27. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 28. 3 TuqaÐoi Grˆfoi TuqaÐoc grˆfoc Erdos–Renyi gia n kìmbouc kai pijanìthta p: erdos_renyi_graph (n,p) TuqaÐoc grˆfoc Gn,p gia n kìmbouc kai pijanìthta p: gnp_random_graph (n,p) TuqaÐoc grˆfoc Gn,m gia n kìmbouc kai m akmèc: gnm_random_graph (n,m) Grˆfoc anadiktÔwshc plègmatoc Strogatz–Watts gia n kìmbouc, o kajènac me k geÐtonec (se topologÐa daktulÐou) kai me pijanìthta anadiktÔwshc p: watts_strogatz_graph (n,k,p) TuqaÐoc grˆfoc Barabasi–Albert gia n kìmbouc kai kˆje nèo kìmbo me m akmèc se upˆrqontec kìmbouc: barabasi_albert_graph (n,m) Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 29. K¸dikac gia ton sqediasmì twn epìmenwn diktÔwn: G9 = nx. erdos_renyi_graph (20 ,0.2) G10 = nx. erdos_renyi_graph (20 ,0.1) G11 = nx. gnp_random_graph (25 ,0.1) G12 = nx. gnm_random_graph (20 ,15) G13 = nx. watts_strogatz_graph (10 ,2,0.4) G14 = nx. barabasi_albert_graph (40 ,3) fig = plt . figure ( figsize =(10 ,10 )) plt . subplot (2,3,1). set_title (" Erdos Renyi (p=0.2)") nx. draw (G9 , node_size =40 , with_labels = False ); plt . axis (" tight ") plt . subplot (2,3,2). set_title (" Erdos Renyi (p=0.1)") nx. draw (G10 , node_size =40 , with_labels = False ); plt . axis (" tight ") plt . subplot (2,3,3). set_title (" Random graph G_{n,p} ") nx. draw (G11 , node_size =40 , with_labels = False ); plt . axis (" tight ") plt . subplot (2,3,4). set_title (" Random graph G_{n,m}") nx. draw (G12 , node_size =40 , with_labels = False ); plt . axis (" tight ") plt . subplot (2,3,5). set_title (" Strogatz - Watts ") nx. draw (G13 , node_size =40 , with_labels = False ); plt . axis (" tight ") plt . subplot (2,3,6). set_title (" Barabasi - Albert ") nx. draw (G14 , node_size =40 , with_labels = False ); plt . axis (" tight ") plt . show () Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 30. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 31. OptikopoÐhsh (Visualization) Grˆfwn me to Gephi Pr¸ta orÐzoume to working directory ìpou jèloume h Python na s¸sei ton grˆfo, ton opoÐon ja sqediˆsoume sth sunèqeia mèsw tou Gephi: import os os. chdir ('pwd ') ìpou to ’pwd’ antistoiqeÐ sth diadrom  ston upostologist  mac. Sth sunèqeia, eisˆgoume ton grˆfo sto NetworkX. P.q.: G = nx. erdos_renyi_graph (200 ,0.01) Amèswc metˆ, exˆgoume autìn ton grˆfo wc arqeÐo .gexf, gia na ton epexergasjeÐ to Gephi: nx. write_gexf (G,'ern . gexf ') Sto Gephi, proqwroÔme wc ex c: Open Graph File... Overview Layout > Apply (Stop) Data Laboratory > Add column [color] > Fill column with a value Partition (refresh) choose color > Apply Preview (refress) Presets > Default Straight Export (gia na s¸soume to diˆgramma tou grˆfou, sun jwc wc .png   pdf.) Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 32. Sq ma: TuqaÐoc grˆfoc Erdos–Renyi gia 200 kìmbouc kai pijanìthta 0.01 sqediasmènoc me to Gephi. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 33. DiepÐpedoi Grˆfoi DiepÐpedoc grˆfoc (two–level graph) onomˆzetai ènac grˆfoc, to sÔnolo koruf¸n tou opoÐou diamerÐzetai se duo uposÔnola, pou onomˆzontai epÐpeda, ètsi ¸ste to sÔnolo twn akm¸n tou grˆfou na diamerÐzetai se trÐa uposÔnola: akmèc metaxÔ twn koruf¸n tou pr¸tou epipèdou, akmèc metaxÔ twn koruf¸n tou deutèrou epipèdou kai akmèc metaxÔ twn koruf¸n tou pr¸tou kai tou deutèrou epipèdou. Me ˆlla lìgia, h diaforˆ diepÐpedou kai dimeroÔc grˆfou eÐnai ìti ston deÔtero den mporoÔn na upˆrqoun akmèc metaxÔ twn koruf¸n tou pr¸tou kai tou deutèrou epipèdou. Mia pr¸th kataskeu  mporeÐ na gÐnei analutikˆ, ’’aposunjètontac’’ to sÔnolo twn koruf¸n enìc dojèntoc grˆfou se duo epÐpeda, ìpwc perigrˆfetai me tic parakˆtw grammèc k¸dika (ki akoloujeÐ o sqediasmìc tou grˆfou autoÔ sthn epìmenh diafˆneia): G=nx. erdos_renyi_graph (20 ,0.3) pos =nx. spring_layout (G) top_set = range (0,8) botom_set = range (8,20) for i in pos : npos = pos [i] if i in top_set : pos [i ]=[ npos [0], npos [1]+2] elif i in botom_set : pos [i ]=[ npos [0], npos [1]-2] plt . figure () nx. draw (G,pos , with_labels =True , nodelist = top_set , node_color ='r') nx. draw (G,pos , with_labels =True , nodelist = botom_set , node_color ='b') plt . show () Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 34. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 35. Mia deÔterh kataskeu  enìc diepÐpedou grˆfou mporeÐ na gÐnei sunjetikˆ, ’’gefur¸nontac’’ duo dojèntec grˆfouc me thn prosj kh akm¸n metaxÔ tou sunìlou twn koruf¸n tou pr¸tou grˆfou kai tou sunìlou twn koruf¸n tou deutèrou grˆfou: J=nx. erdos_renyi_graph (15 ,0.17) # First level graph F=nx. erdos_renyi_graph (20 ,0.17) # Second level graph H=nx. bipartite_random_graph (15 ,20 ,0.1) # The bridging bipartite graph G=nx. Graph () # The two -- level graph for node in J. nodes (): G. add_node (node , bipartite =0) for edge in J. edges (): G. add_edge ( edge [0], edge [1]) for edge in F. edges (): G. add_edge ( edge [0]+k, edge [1]+k) for node in F. nodes (): G. add_node ( node +k, bipartite =1) for edge in H. edges ( data = True ): G. add_edge ( edge [0], edge [1]) pos =nx. spring_layout (G) top_set = set () botom_set = set () for i in pos : npos = pos [i] if G. node [i][ 'bipartite ']== 0: pos [i ]=[ npos [0], npos [1]+2] top_set .add(i) elif G. node [i][ 'bipartite ']== 1: pos [i ]=[ npos [0], npos [1]-2] botom_set . add (i) plt . figure () nx. draw (G,pos , with_labels =True , nodelist = list ( top_set ), node_color ='r') nx. draw (G,pos , with_labels =True , nodelist = list ( botom_set ), node_color ='b') plt . show () Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 36. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 37. Se aut n kai thn epìmenh diafˆneia dÐnetai o k¸dikac kataskeu c enìc diepÐpedou grˆfou tou paradeÐgmatoc dieujunt¸n–etairei¸n (managers–companies). Sth mejepìmenh diafˆneia akoloujeÐ o k¸dikac tou sqediasmoÔ tou grˆfou autoÔ, ìpwc apeikonÐzetai sthn amèswc epìmenh diafˆneia: directors = {0:"a",1:"b",2:"c",3:"d",4:"e"} companies ={0:"A",1:"B",2:"C",3:"D",4:"E",5:"F"} labels = directors . copy () newkey = len ( directors . keys ()) for k in companies . keys (): labels [k+ newkey ]= companies [k] J=nx. erdos_renyi_graph (5,0.8) # Directors F=nx. erdos_renyi_graph (6,0.6) # Companies H=nx. bipartite_random_graph (5,6,0.55) # Directors in Companies G=nx. Graph () #Two - Level Graph from networkx . algorithms import bipartite for node in J. nodes (): G. add_node (node , bipartite =0) for edge in J. edges (): G. add_edge ( edge [0], edge [1]) for edge in F. edges (): G. add_edge ( edge [0]+5, edge [1]+5) for node in F. nodes (): G. add_node ( node +5, bipartite =1) for edge in H. edges ( data = True ): G. add_edge ( edge [0], edge [1]) Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 38. posJ =nx. spring_layout (J) posF =nx. spring_layout (F) posH ={0:(0,0),1:(0,2),2:(0,4),3:(0,6),4:(0,8),5:(1,-2),6:(1,0),7:(1,2),8:(1,4), 9:(1,6),10 :(1,8)} mode1 , mode2 = bipartite . sets (H) pos =nx. spring_layout (G) top_set =set () botom_set = set () for i in pos : npos = pos [i] if G. node [i][ 'bipartite ']== 0: pos [i ]=[ npos [0], npos [1]+2] top_set .add(i) elif G. node [i][ 'bipartite ']== 1: pos [i ]=[ npos [0], npos [1]-2] botom_set .add(i) Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 39. fig = plt . figure ( figsize =(13 ,13 )) plt . subplot (2,2,1). set_title (" Friendship Network of Directors ") nx. draw (J, pos =posJ , node_color ='r',node_size =700 , font_size =20 , font_color ='# FFFFFF ', with_labels = False ) nx. draw_networkx_labels (J,posJ , directors , font_size =20 , font_color ='# FFFFFF ') plt . axis (" tight ") plt . subplot (2,2,2). set_title (" Collaboration Network of Companies ") nx. draw (F, pos =posF , node_color ='b',node_size =800 , font_size =20 , font_color ='# FFFFFF ', node_shape ='s', with_labels = False ) nx. draw_networkx_labels (F,posF , companies , font_size =20 , font_color ='# FFFFFF ') plt . axis (" tight ") plt . subplot (2,2,3). set_title ("Two - Mode network of Directors and Companies ") nx. draw_networkx_nodes (H, pos =posH , nodelist = list ( mode1 ), node_color ='r', node_size = 700) nx. draw_networkx_nodes (H, pos =posH , nodelist = list ( mode2 ), node_color ='b', node_size =800 , node_shape ='s') nx. draw_networkx_edges (H, pos = posH ) nx. draw_networkx_labels (H,posH ,labels , font_size =20 , font_color ='# FFFFFF ') plt . axis ('off ') plt . axis (" tight ") plt . subplot (2,2,4). set_title ("Two - Level Network of Directors and Companies ") nx. draw (G,pos , nodelist = list ( top_set ), node_color ='r',node_size =700 , with_labels = False ) nx. draw (G,pos , nodelist = list ( botom_set ), node_color ='b',node_size =800 , node_shape ='s', with_labels = False ) nx. draw_networkx_labels (G,pos , labels , font_size =20 , font_color ='# FFFFFF ') plt . axis (" tight ") Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 40. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 41. SunjetikoÐ EgwkentrikoÐ Grˆfoi Egwkentrikìc grˆfoc   dÐktuo (egocentric graph/network) onomˆzetai ènac grˆfoc, gia ton opoÐon upˆrqei mia koruf , pou onomˆzontai ’’eg¸,’’, h opoÐa sundèetai me ìlec tic ˆllec korufèc tou grˆfou autoÔ. AkoloujeÐ mia sunjetik  kataskeu  wc eidik  perÐptwsh sunjetikoÔ diepÐpedou grˆfou, ston opoÐon to èna apì ta duo epÐpeda apoteleÐtai apì mia mình koruf  (to ’’eg¸’’), h opoÐa sundèetai me ìlec tic korufèc tou ˆllou epipèdou: J=nx. erdos_renyi_graph (20 ,0.1) F=nx. erdos_renyi_graph (1,1) H=nx. bipartite_random_graph (20 ,1,1) G=nx. Graph () for node in J. nodes (): G. add_node (node , bipartite =0) for edge in J. edges (): G. add_edge ( edge [0], edge [1]) for edge in F. edges (): G. add_edge ( edge [0]+k, edge [1]+k) for node in F. nodes (): G. add_node ( node +k, bipartite =1) for edge in H. edges ( data = True ): G. add_edge ( edge [0], edge [1]) pos =nx. spring_layout (G) top_set = set (); botom_set =set () for i in pos : npos = pos [i] if G. node [i][ 'bipartite ']== 0: pos [i ]=[ npos [0], npos [1]+2] top_set .add(i) elif G. node [i][ 'bipartite ']== 1: pos [i ]=[ npos [0], npos [1]-2] botom_set . add (i) plt . figure () nx. draw (G,pos , with_labels =True , nodelist = list ( top_set ), node_color ='r') nx. draw (G,pos , with_labels =True , nodelist = list ( botom_set ), node_color ='b') plt . show () Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 42. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 43. 2. BasikoÐ UpologismoÐ thc JewrÐac Grˆfwn GeitnÐash Kìmbwn BajmoÐ Kìmbwn BajmoÐ Kìmbwn Mh Kateujunìmenwn Grˆfwn BajmoÐ Kìmbwn Kateujunìmenwn Grˆfwn Rabdogrˆmmata Bajm¸n Kìmbwn Grˆfwn Istogrˆmmata Katanom c Bajm¸n Kìmbwn Grˆfwn Istogrˆmmata Katanom c Bajm¸n Kìmbwn Megˆlwn Grˆfwn Sundesimìthta Sundedemènec Sunist¸sec Mh Kateujunìmenwn Grˆfwn Isqur¸c Sundedemènec Sunist¸sec Kateujunìmenwn Grˆfwn Asjen¸c Sundedemènec Sunist¸sec Kateujunìmenwn Grˆfwn Elkustikèc Sunist¸sec Kateujunìmenwn Grˆfwn Disundedemènec Sunist¸sec Mh Kateujunìmenwn Grˆfwn KlÐkec Kìmbwn Algìrijmoi BFS, DFS kai Dkstra Apostˆseic Kìmbwn Upogrˆfoi kai IsomorfismoÐ Grˆfwn Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 44. GeitnÐash Kìmbwn 1 GeitnÐash Kìmbwn se Mh Kateujunìmenouc Grˆfouc 'Estw ìti èqoume ènan mh kateujunìmeno (aplì) grˆfo G. Oi parakˆtw entolèc dÐnoun antistoÐqwc: to sÔnolo twn kìmbwn, to sÔnolo twn akm¸n kai touc geÐtonec tou kìmbou i tou G: G. nodes () G. edges () G. neighbors (i) O pÐnakac geitnÐashc A tou grˆfou G, pou eÐnai ènac summetrikìc pÐnakac n n (ìpou n eÐnai to pl joc twn kìmbwn tou G) me stoiqeÐa 0   1, upologÐzetai kai tup¸netai apì tic ex c entolèc: A = nx. adjacency_matrix (G) print (A. todense ()) Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 45. Gia parˆdeigma, gia ton tuqaÐo grˆfo Erdos–Renyi G =nx. erdos_renyi_graph (10 ,0.5) brÐskoume ta ex c sÔnola kìmbwn, akm¸n, geitìnwn tou kìmbou 4 kai pÐnaka geitnÐashc tou grˆfou (antistoÐqwc): [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [(0, 9), (0, 5), (0, 6), (0, 7), (1, 2), (1, 4), (1, 5), (1, 7), (1, 8), (1, 9), (2, 8), (2, 9), (2, 7), (3, 8), (3, 9), (3, 5), (3, 6), (3, 7), (4, 8), (4, 5), (5, 6), (5, 7), (5, 8), (6, 7), (7, 9), (8, 9)] [8, 1, 5] [[0 1 1 0 0 0 0 1 0 1] [1 0 0 1 0 1 0 0 0 0] [1 0 0 0 1 1 1 0 0 0] [0 1 0 0 0 0 0 0 1 0] [0 0 1 0 0 1 1 0 1 0] [0 1 1 0 1 0 0 1 1 0] [0 0 1 0 1 0 0 0 1 0] [1 0 0 0 0 1 0 0 0 1] [0 0 0 1 1 1 1 0 0 0] [1 0 0 0 0 0 0 1 0 0]] Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 46. O sqediasmìc tou grˆfou mporeÐ na gÐnei me tic entolèc: plt . figure () nx. draw (G, with_labels =True , node_color ='g',alpha =0.5) plt . show () Epiplèon, gia ton pÐnaka geitnÐashc, mporoÔme na sqediˆsoume to kaloÔmeno spy plot me ton ex c trìpo: adjacency_matrix = nx. to_numpy_matrix (G) fig = plt . figure ( figsize =(5, 5)) plt . imshow ( adjacency_matrix , cmap = Greys , interpolation = none ) plt . show () Ta sqèdia tou grˆfou kai tou spy plot tou pÐnaka geitnÐas c tou brÐskontai sthn epìmenh diafˆneia. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 47. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 48. 2 GeitnÐash Kìmbwn se Kateujunìmenouc Grˆfouc 'Estw t¸ra ìti èqoume ènan kateujunìmeno grˆfo G. Oi parakˆtw entolèc dÐnoun antistoÐqwc: to sÔnolo twn kìmbwn, to sÔnolo twn akm¸n, touc exerqìmenouc geÐtonec tou kìmbou i proc touc opoÐouc kateujÔnontai oi akmèc pou arqÐzoun apì ton i kai touc eiserqìmenouc geÐtonec tou kìmbou i apì touc opoÐouc arqÐzoun oi akmèc pou kateujÔnontai ston i: G. nodes () G. edges () G. neighbors (i) G. predecessors (i) O pÐnakac geitnÐashc A tou grˆfou G, pou eÐnai t¸rac ènac mh summetrikìc pÐnakac n n (ìpou n eÐnai to pl joc twn kìmbwn tou G) me stoiqeÐa 0   1, upologÐzetai kai tup¸netai apì tic Ðdiec entolèc: A = nx. adjacency_matrix (G) print (A. todense ()) Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 49. Gia parˆdeigma, gia ton kateujunìmeno tuqaÐo grˆfo Erdos–Renyi G = nx. erdos_renyi_graph (10 ,0.5, directed = True ) brÐskoume ta ex c sÔnola kìmbwn, akm¸n, exerqìmenwn geitìnwn tou kìmbou 4, eiserqìmenwn geitìnwn tou kìmbou 4 kai pÐnaka geitnÐashc tou grˆfou (antistoÐqwc): [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [(0, 8), (0, 1), (0, 6), (0, 7), (1, 8), (1, 9), (1, 3), (1, 5), (1, 6), (2, 0), (2, 3), (2, 4), (2, 5), (2, 6), (2, 7), (2, 8), (2, 9), (3, 0), (3, 1), (3, 2), (3, 4), (3, 8), (3, 9), (4, 8), (4, 1), (4, 2), (4, 6), (4, 7), (5, 0), (5, 1), (5, 2), (5, 3), (5, 9), (6, 2), (6, 4), (6, 5), (7, 0), (7, 1), (7, 2), (7, 3), (7, 5), (7, 8), (7, 9), (8, 0), (8, 1), (8, 2), (8, 3), (8, 6), (8, 9), (9, 8), (9, 5), (9, 6), (9, 7)] [8, 1, 2, 6, 7] [2, 3, 6] [[0 1 0 0 0 0 1 1 1 0] [0 0 0 1 0 1 1 0 1 1] [1 0 0 1 1 1 1 1 1 1] [1 1 1 0 1 0 0 0 1 1] [0 1 1 0 0 0 1 1 1 0] [1 1 1 1 0 0 0 0 0 1] [0 0 1 0 1 1 0 0 0 0] [1 1 1 1 0 1 0 0 1 1] [1 1 1 1 0 0 1 0 0 1] [0 0 0 0 0 1 1 1 1 0]] Sthn epìmenh diafˆneia, blèpoume ton sqediasmì tou grˆfou autoÔ kai to spy plot tou pÐnaka geitnÐas c tou, pou èginan me tic Ðdiec entolèc sqediasmoÔ pou dìjhkan gia thn perÐptwsh twn mh kateujunìmenwn grˆfwn. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 50. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 51. BajmoÐ Kìmbwn 1 BajmoÐ Kìmbwn Mh Kateujunìmenwn Grˆfwn 'Estw ìti èqoume ènan mh kateujunìmeno (aplì) grˆfo G. O bajmìc tou kìmbou i tou G orÐzetai wc to pl joc twn geitìnwn tou i. Oi parakˆtw entolèc dÐnoun antistoÐqwc: ton bajmì tou kìmbou i kai to sÔnolo–lexikì twn bajm¸n ìlwn twn kìmbwn tou G: G. degree (i) G. degree () # the same as nx . degree (G) To diˆgramma tou mh kateujunìmenou grˆfou tou prohgoÔmenou paradeÐgmatoc sqediˆzetai sthn epìmenh diafˆneia ètsi ¸ste na faÐnetai o kìmboc i, oi geÐtonèc tou ki o bajmìc tou i (ed¸ i = 4). Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 52. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 53. 2 BajmoÐ Kìmbwn Kateujunìmenwn Grˆfwn 'Estw t¸ra ìti èqoume ènan kateujunìmeno grˆfo G. O exerqìmenoc bajmìc (out–degree) tou kìmbou i tou G orÐzetai wc to pl joc twn exerqìmenwn geitìnwn tou i kai o eiserqìmenoc bajmìc (in–degree) tou kìmbou i tou G orÐzetai wc to pl joc twn eiserqìmenwn geitìnwn tou i. O olikìc bajmìc (total degree) tou i orÐzetai wc to ˆjroisma tou exerqìmenou kai tou eiserqìmenou bajmoÔ tou i. Oi parakˆtw entolèc dÐnoun antistoÐqwc: ton exerqìmeno, eiserqìmeno, olikì bajmì tou kìmbou i kai ta sÔnola–lexikˆ twn antÐstoiqwn bajm¸n ìlwn twn kìmbwn tou G: G. out_degree (i) # the same as len (G. neighbors (i)) G. in_degree (i) # the same as len (G. predecessors (i )) G. degree () # the same as nx . degree (G) = G. out_degree (i) + G. in_degree (i) Sthn epìmenh diafˆneia faÐnontai oi bajmoÐ enìc kìmbou gia to parˆdeigmˆ mac. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 54. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 55. 3 Rabdogrˆmmata Bajm¸n Kìmbwn Grˆfwn 'Ena rabdìgramma bajm¸n kìmbwn eÐnai apl¸c h grafik  parˆstash thc metabol c twn diatetagmènwn se fjÐnousa seirˆ bajm¸n twn kìmbwn enìc grˆfou, oi opoÐoi kìmboi paratÐjentai me thn antÐstoiqh (proc touc bajmoÔc) seirˆ, ston ˆxona x. Gia ènan mh kateujunìmeno grˆfo G, qrhsimopoioÔme tic parakˆtw entolèc gia thn paragwg  kai ton sqediasmì tou rabdogrˆmmatoc autoÔ: deg =G. degree () deg_dic = dict () for nd in deg : if deg [nd] not in deg_dic : deg_dic [deg[nd ]]=[ nd] else : deg_dic [deg[nd ]]. append (nd) deg_lis =[] nd_lis =[] for de in sorted ( deg_dic . keys (), reverse = True ): for nn in deg_dic [de ]: deg_lis . append (de) nd_lis . append (nn) index = np. arange ( len ( nd_lis )) bar_width = 1 plt . bar (index , deg_lis , bar_width , color ='g') Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 56. Sto sq ma pou akoloujeÐ blèpoume èna parˆdeigma enìc rabdogrˆmmatoc bajm¸n enìc mh kateujunìmenou grˆfou: 'Otan o grˆfoc eÐnai kateujunìmenoc, èqoume afenìc to rabdìgramma twn exerqìmenwn bajm¸n kìmbwn kai afetèrou to rabdìgramma twn eiserqìmenwn bajm¸n kìmbwn. Oi tropopoi seic tou prohgoÔmenou k¸dika gia rabdogrˆmmata mh kateujunìmenwn grˆfwn eÐnai profaneÐc. Sthn epìmenh diafˆneia akoloujoÔn paradeÐgmata rabdogrammˆtwn exerqìmenwn kai eiserqìmenwn bajm¸n enìc kateujunìmenou grˆfou. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 57. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 58. 4 Istogrˆmmata Katanom c Bajm¸n Kìmbwn Grˆfwn 'Ena istìgramma katanom c bajm¸n kìmbwn eÐnai h grafik  parˆstash thc metabol c tou pl jouc twn kìmbwn enìc grˆfou, ston ˆxona y, pou eqoun kˆpoio bajmì (se aÔxousa seirˆ), ston ˆxona x. To istìgramma katanom c bajm¸n kìmbwn enìc mh kateujunìmenou grˆfou G sqediˆzetai me thn ex c entol : hist ( deg . values (), bins = len ( set (G. degree (). values ()))) Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 59. Sto sq ma pou akoloujeÐ blèpoume èna parˆdeigma enìc istogrˆmmatoc katanom c bajm¸n enìc mh kateujunìmenou grˆfou: 'Otan o grˆfoc eÐnai kateujunìmenoc, èqoume afenìc to istìgramma katanom c twn exerqìmenwn bajm¸n kìmbwn kai afetèrou to istìgramma katanom c twn eiserqìmenwn bajm¸n kìmbwn. Oi tropopoi seic tou prohgoÔmenou k¸dika gia rabdogrˆmmata mh kateujunìmenwn grˆfwn eÐnai profaneÐc. Sthn epìmenh diafˆneia akoloujoÔn paradeÐgmata istogrammˆtwn exerqìmenwn kai eiserqìmenwn bajm¸n enìc kateujunìmenou grˆfou. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 60. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 61. Epiplèon, gia ènan kateujunìmeno grˆfo, mporoÔme na sqediˆsoume to dusdiˆstato istìgramma thc koin c katanom c twn exerqìmenwn kai twn eiserqìmenwn bajm¸n kìmbwn. Gia to prohgoÔmeno parˆdeigma, paÐrnoume to ex c dusdiˆstato istìgramma (mèsw tou k¸dika pou dÐnetai sto mˆjhma): Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 62. 5 Istogrˆmmata Katanom c Bajm¸n Kìmbwn Megˆlwn Grˆfwn Tupikˆ, oi tuqaÐoi megˆloi grˆfoi Edos–Renyi teÐnoun na akoloujoÔn thn diwnumik  katanom , ìpwc faÐnetai sthn epìmenh diafˆneia gia ènan tuqaÐo (mh kateujunìmeno) grˆfo Edos–Renyi 5000 kìmbwn me pijanìthta 0.25, pr¸ta se dekadikèc kai metˆ se logarijmikèc klÐmakec. Sthn perÐptwsh ìmwc twn onomazìmenwn tuqaÐwn grˆfwn anexart twn klÐmakac (scale–free graphs), oi grˆfoi autoÐ teÐnoun na akoloujoÔn thn katanom  tou nìmou dÔnamhc (power law distribution), ìpwc faÐnetai sthn mejepìmenh diafˆneia gia ènan tuqaÐo (mh kateujunìmeno) grˆfo Barabasi­Albert 5000 kìmbwn me m = 3, pr¸ta se dekadikèc kai metˆ se logarijmikèc klÐmakec. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 63. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 64. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 65. Sundesimìthta 1 Sundedemènec Sunist¸sec Mh Kateujunìmenwn Grˆfwn 'Enac mh kateujunìmenoc grˆfoc lègetai sundedemènoc an gia kˆje duo korufèc tou upˆrqei mia diadrom  (path) pou tic en¸nei. Diaforetikˆ, o grˆfoc lègetai mh sundedemènoc. An ènac (mh kateujunìmenoc) grˆfoc den eÐnai sundedemènoc, tìte perièqei kˆpoiec (toulˆqiston duo) sundedemènec sunist¸sec. Mia sundedemènh sunist¸sa eÐnai ènac mègistoc sundedemènoc upogrˆfoc tou grˆfou autoÔ. H megalÔterh sundedemènh sunist¸sa sun jwc onomˆzetai gigantiaÐa sundedemènh sunist¸sa. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 66. Gia ènan mh kateujunìmeno grˆfo G, qrhsimopoioÔme tic parakˆtw entolèc gia thn diereÔnhsh thc sundesimìthtˆc tou (leptomèreiec gia to p¸c qrhsimopoioÔntoi oi entolèc autèc dÐnontai sto skript connectedness.py): nx. is_connected (G) nx. number_connected_components (G) nx. connected_components (G) connected_component_subgraphs (G) AkoloujeÐ èna parˆdeigma enìc mh sundedemènou (mh kateujunìmenou) tuqaÐou grˆfou me 5 sundedemènec sunist¸sec (metaxÔ twn opoÐwn oi 2 eÐnai apomonwmènoi kìmboi). Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 67. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 68. 2 Isqur¸c Sundedemènec Sunist¸sec Kateujunìmenwn Grˆfwn 'Enac kateujunìmenoc grˆfoc lègetai isqur¸c sundedemènoc an gia kˆje duo korufèc tou upˆrqei mia kateujunìmenh diadrom  pou tic en¸nei mèsw miac alusÐdac kateujunìmenwn akm¸n, oi opoÐec èqoun thn Ðdia forˆ kateujÔnsewn. An ènac (kateujunìmenoc) grˆfoc den eÐnai isqur¸c sundedemènoc, tìte perièqei kˆpoiec (toulˆqiston duo) isqur¸c sundedemènec sunist¸sec. Mia isqur¸c sundedemènh sunist¸sa eÐnai ènac mègistoc isqur¸c sundedemènoc upogrˆfoc tou grˆfou autoÔ. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 69. Gia ènan kateujunìmeno grˆfo G, qrhsimopoioÔme tic parakˆtw entolèc gia thn diereÔnhsh thc isqur c sundesimìthtˆc tou (leptomèreiec gia to p¸c qrhsimopoioÔntoi oi entolèc autèc dÐnontai sto skript connectedness.py): nx. is_strongly_connected (G) nx. number_strongly_connected_components (G) nx. strongly_connected_components (G) strongly_connected_component_subgraphs (G) AkoloujeÐ èna parˆdeigma enìc mh isqur¸c sundedemènou (kateujunìmenou) tuqaÐou grˆfou me 3 isqur¸c sundedemènec sunist¸sec (kai qwrÐc apomonwmènouc kìmbouc). Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 70. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 71. Dojèntoc enìc mh isqur¸c sundedemènou kateujunìmenou grˆfou G, mporoÔme na kataskeuˆsoume ènan grˆfo S, pou onomˆzetai sumpuknwmènoc grˆfoc   grˆfoc thc sumpÔknwshc tou G, oi kìmboi tou opoÐou eÐnai oi isqur¸c sundedemènec sunist¸sec tou G kai oi akmèc metaxÔ twn kìmbwn tou S antistoiqoÔn stic akmèc tou G. O sumpuknwmènoc grˆfoc S eÐnai profan¸c ènac akuklikìc kateujunìmenoc grˆfoc. Sthn epìmenh diafˆneia blèpoume ènan mh isqur¸c sundedemèno (kateujunìmeno) tuqaÐo grˆfo kai ton antÐstoiqo sumpuknwmèno grˆfo. O grˆfoc autìc èqei 2 isqur¸c sunededemènec sunist¸sec me 3 kìmbouc, 3 me 2 kìmbouc kai 8 me 1 kìmbo. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 72. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 73. 3 Asjen¸c Sundedemènec Sunist¸sec Kateujunìmenwn Grˆfwn 'Enac kateujunìmenoc grˆfoc lègetai asjen¸c sundedemènoc an gia kˆje duo korufèc tou upˆrqei mia diadrom  pou tic en¸nei mèsw miac alusÐdac akm¸n, oi opoÐec ìmwc den qreiˆzetai na èqoun thn Ðdia forˆ kateujÔnsewn. Me ˆlla lìgia, h asjen c sundesimìthta enìc kateujunìmenou grˆfou isodunameÐ me sundesimìthta, ìtan den lambˆnetai upìyh h kateÔjunsh twn akm¸n. An ènac (kateujunìmenoc) grˆfoc den eÐnai asjen¸c sundedemènoc, tìte perièqei kˆpoiec (toulˆqiston duo) asjen¸c sundedemènec sunist¸sec. Mia asjen¸c sundedemènh sunist¸sa eÐnai ènac mègistoc asjen¸c sundedemènoc upogrˆfoc tou grˆfou autoÔ. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 74. Gia ènan kateujunìmeno grˆfo G, qrhsimopoioÔme tic parakˆtw entolèc gia thn diereÔnhsh thc asjenoÔc sundesimìthtˆc tou (leptomèreiec gia to p¸c qrhsimopoioÔntoi oi entolèc autèc dÐnontai sto skript connectedness.py): nx. is_weakly_connected (G) nx. number_weakly_connected_components (G) nx. weakly_connected_components (G) weakly_connected_component_subgraphs (G) AkoloujeÐ èna parˆdeigma enìc mh asjen¸c sundedemènou (kateujunìmenou) tuqaÐou grˆfou me 7 asjen¸c sundedemènec sunist¸sec (metaxÔ twn opoÐwn oi 2 eÐnai apomonwmènoi kìmboi). Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 75. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 76. 4 Elkustikèc Sunist¸sec Kateujunìmenwn Grˆfwn Se ènan kateujunìmeno grˆfo, mia isqur¸c sundedemènh sunist¸sa onomˆzetai elkustik    elkÔousa sunist¸sa an kˆje kateujunìmenh diadrom  pou eisèrqetai mèsa se aut n thn sunist¸sa potè den bgaÐnei èxw apì aut n. Gia ènan kateujunìmeno grˆfo G, qrhsimopoioÔme tic parakˆtw entolèc gia thn diereÔnhsh twn elkustik¸n sunistws¸nc tou (leptomèreiec gia to p¸c qrhsimopoioÔntoi oi entolèc autèc dÐnontai sto skript connectedness.py): nx. is_attracting_component (G) nx. number_attracting_components (G) nx. attracting_components (G) nx. attracting_component_subgraphs (G) AkoloujeÐ èna parˆdeigma enìc (kateujunìmenou) tuqaÐou grˆfou me 2 elkustikèc sunist¸sec, ìpou sqediˆzetai kai o antÐstoiqoc sumpuknwmènoc grˆfoc. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 77. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 78. 5 Disundedemènec Sunist¸sec Mh Kateujunìmenwn Grˆfwn 'Enac mh kateujunìmenoc grˆfoc onomˆzetai disundedemènoc (bicoonected) an den aposundèetai me thn apokop  opoioud pote kìmbou tou. Se ènan mh kateujunìmeno grˆfo, ènac mègistoc upogrˆfoc, pou eÐnai tètoioc ¸ste na mhn aposundèetai me thn apokop  opoioud pote kìmbou tou upogrˆfou autoÔ, onomˆzetai disundedemènh sunist¸sa tou grˆfou. 'Enac kìmboc enìc mh disundedemènou grˆfou apoteleÐ èna shmeÐo diˆrjrwshc (articulation point)   koruf  apokop c (cut vertex) an kai mìnon an o kìmboc autìc an kei se toulˆqiston duo disundedemènec sunist¸sec tou grˆfou autoÔ. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 79. Gia ènan kateujunìmeno grˆfo G, qrhsimopoioÔme tic parakˆtw entolèc gia thn diereÔnhsh thc disundesimìthtˆc tou (leptomèreiec gia to p¸c qrhsimopoioÔntoi oi entolèc autèc dÐnontai sto skript connectedness.py): nx. is_biconnected (G) nx. biconnected_component_subgraphs (G) nx. biconnected_component_edges (G) nx. articulation_points (G) AkoloujeÐ èna parˆdeigma enìc mh disundedemènou (mh kateujunìmenou) tuqaÐou grˆfou me 6 disundedemènec sunist¸sec kai 5 shmeÐa diˆrjrwshc. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 80. Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 81. KlÐkec Kìmbwn Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 82. Algìrijmoi BFS, DFS kai Dkstra Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 83. Apostˆseic Kìmbwn Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 84. Upogrˆfoi kai IsomorfismoÐ Grˆfwn Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 85. 3. Diktuakˆ Mètra Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 86. 4. DiamerismoÐ Grˆfwnn Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 87. 5. Taxinomhsimìthta – Anameiximìthta Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 88. 6. Ekjetikˆ Montèla TuqaÐwn Grˆfwn Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python
  • 89. 7. Qronik¸c Metaballìmenoi Grˆfoi Mwus c A. MpountourÐdhc DiktuakoÐ UpologismoÐ me thn Python