Algorithms For Dummies


USE OF WHITESPACE IN OUTPUT



Download 7,18 Mb.
Pdf ko'rish
bet297/651
Sana15.07.2021
Hajmi7,18 Mb.
#120357
1   ...   293   294   295   296   297   298   299   300   ...   651
Bog'liq
Algorithms

USE OF WHITESPACE IN OUTPUT

The output for this example appears on two lines in the book, even though it appears 

on just one line in Jupyter Notebook. The addition of whitespace helps the output 

appear in a readable size on the page — it doesn’t affect the actual information. Other 

examples in the book also show output on multiple lines, even when it appears on a 

single line in Jupyter Notebook.




CHAPTER 8

  Understanding Graph Basics 

     167


import networkx as nx

import matplotlib.pyplot as plt

%matplotlib inline

AGraph = nx.Graph()

Nodes = range(1,6)

Edges = [(1,2), (2,3), (3,4), (4,5), (1,3), (1,5), (1,6)]

AGraph.add_nodes_from(Nodes)

AGraph.add_edges_from(Edges)

nx.degree_centrality(AGraph)

{1: 0.8, 2: 0.4, 3: 0.6000000000000001, 4: 0.4, 5: 0.4,

 6: 0.2}

The values differ by the number of connections for each node. Because node 1 has 

four connections (it has the highest degree), it also has the highest centrality. You 

can see how this works by plotting the graph using a call to 

nx.draw(AGraph, 

with_labels=True)

, as shown in Figure 8-5.

FIGURE 8-5: 

Plotting the graph 

can help you see 

degree centrality 

with greater ease.



168

 

   


  PART 3 


Download 7,18 Mb.

Do'stlaringiz bilan baham:
1   ...   293   294   295   296   297   298   299   300   ...   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