-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo.py
42 lines (30 loc) · 974 Bytes
/
info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import copy
def densidade(vertices, arestas):
d = len(arestas) / (len(vertices) * (len(vertices) - 1))
return d
def complemento(matAdj):
matComp = [[0 for x in range(len(matAdj))] for x in range(len(matAdj))]
for i in range(len(matAdj)):
for j in range(len(matAdj)):
if i != j:
if matAdj[i][j] == 0:
matComp[i][j] = 1
return matComp
def completo(matAdj):
for i in range(len(matAdj)):
for j in range(len(matAdj[i])):
if i != j:
if matAdj[i][j] == 0:
return False
return True
def regular(matrizAdj):
prevDegree = None
for i in range(0, len(matrizAdj)):
degree = 0
for j in range(0, len(matrizAdj[i])):
if matrizAdj[i][j] != 0:
degree = degree + 1
if prevDegree != None and degree != prevDegree:
return False
prevDegree = degree
return True