Algorithms For Dummies


Understanding Graph Basics



Download 7,18 Mb.
Pdf ko'rish
bet302/651
Sana15.07.2021
Hajmi7,18 Mb.
#120357
1   ...   298   299   300   301   302   303   304   305   ...   651
Bog'liq
Algorithms

  Understanding Graph Basics 

     171


In addition, the number of nodes affects its content. If n is number of nodes, you 

find a minimum of (n−1) ones and a maximum of n(n−1) ones. The fact that the 

number of ones is few or large makes the graph dense or sparse, and that’s rele-

vant because if the connection between nodes are few, such as in the case of web-

sites, more efficient solutions exist for storing graph data.

Using sparse representations

The SciPy package also performs various math, scientific, and engineering tasks. 

When using this package, you can rely on a sparse matrix to hold the data. A 

sparse matrix is one in which only the actual connections appear in the matrix; all 

other entries don’t exist. Using a sparse matrix saves resources because the mem-

ory requirements for a sparse matrix are small. Here is the code you use to create 

a SciPy sparse matrix from a NetworkX graph:

print(nx.to_scipy_sparse_matrix(AGraph))

  (0, 1)    1

  (0, 2)    1

  (0, 4)    1

  (0, 5)    1

  (1, 0)    1

  (1, 2)    1

  (2, 0)    1

  (2, 1)    1

  (2, 3)    1

  (3, 2)    1

  (3, 4)    1

  (4, 0)    1

  (4, 3)    1

  (5, 0)    1

As you can see, the entries show the various edge coordinates. Each active 

coordinate has a 1 associated with it. The coordinates are 0 based. This means that 

(0, 1)

 actually refers to a connection between nodes 1 and 2.




Download 7,18 Mb.

Do'stlaringiz bilan baham:
1   ...   298   299   300   301   302   303   304   305   ...   651




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2025
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish