SlideShare a Scribd company logo
 Basic Python
› Data types(Integer, String, List)
› Control flow statements
› List comprehension
 Import NetworkX
import networkx as nx
 Generating a graph
G = nx.Graph()
 Adding a node
G.add_node(“one”)
 Adding nodes
G.add_nodes_from([“two”, “three”])
 Adding an edge
G.add_edge(“one”, “two”)
 Adding edges
G.add_edges_from([(“two”, “three”), (“three”, “one”)])
import matplotlib.pyplot as plt
nx.draw(G)
plt.show()
 Path graphs
› G = nx.path_graph(40)
 Cycle graphs
› G = nx.cycle_graph(40)
 Complete graphs
› G = nx.complete_graph(40)
 2D grid graphs
› G = nx.grid_2d_graph(5, 4)
 Random graphs
› G = nx.erdos_renyi_graph(20, 0.3)
› G = nx.barabasi_albert_graph(100, 5)
 The number of degrees
› len(G.nodes())
 The number of edges
› len(G.edges())
 Average degree
› 2 * len(G.edges()) / len(G.nodes())
 Average path length
› Gsub = nx.connected_component_subgraphs(G)[0]
› nx.average_shortest_path_length(G)
 Network density
› nx.density(G)
deg = [nx.degree(G,n) for n in G.nodes()]
hist = [0 for i in range(max(deg)+1)]
for d in deg:
hist[d] += 1
plt.plot(range(len(hist)), hist, "or")
plt.show()
 Go to http://apps.twitter.com and create your app .
› You will get API Key, API Secret, Access Token, and Access Token Secret.
 Installing tweepy
› pip install tweepy
 Next, many, many lines of python code
 You can get the python script(named
Tweepy1.py) at
https://codebreak.com/git/arity/TweepyTutori
al/tree/master/
import time
import tweepy
# Copy the api key, the api secret, the access token and the access
# token secret from the relevant page on your Twitter app
api_key = ‘your_api_key_here'
api_secret = ‘your_api_secret_here’
access_token = ‘your_access_token_here'
access_token_secret = ‘your_access_token_secret_here'
# You don't need to make any changes below here
# This bit authorises you to ask for information from Twitter
auth = tweepy.OAuthHandler(api_key, api_secret)
auth.set_access_token(access_token, access_token_secret)
# The api object gives you access to all of the http calls that Twitter accepts
api = tweepy.API(auth)
def fib(n,user,network):
if n>0:
time.sleep(40)
try:
users=api.followers(user)
except tweepy.TweepError:
return
for follower in users:
network.add_node(follower.screen_name)
network.add_edge(follower.screen_name, user)
fib(n-1,follower.screen_name,network)
#Then, There is a directed graph
G = nx.DiGraph()
#User we want to use as initial node
user='GitHub‘
G.add_node(user)
n=2
fib(n,user,G)
nx.draw(G)
plt.show()
 Graph manipulating functions
› Adding nodes, edges
 Many types of network
 Many network characteristics

More Related Content

What's hot

Insert element position
Insert element positionInsert element position
Insert element position
Kavya Shree
 
Insertion operation
Insertion operationInsertion operation
Insertion operation
kalpanasatishkumar
 
Grand Central Dispatch
Grand Central DispatchGrand Central Dispatch
Grand Central Dispatch
Joachim Bengtsson
 
Data Visualization — Le funzionalità matematiche di Sage per la visualizzazio...
Data Visualization — Le funzionalità matematiche di Sage per la visualizzazio...Data Visualization — Le funzionalità matematiche di Sage per la visualizzazio...
Data Visualization — Le funzionalità matematiche di Sage per la visualizzazio...
Andrea Lazzarotto
 
Dynamically linked queues
Dynamically linked queuesDynamically linked queues
Dynamically linked queues
Jonghoon Park
 
C# 8 and Beyond
C# 8 and BeyondC# 8 and Beyond
C# 8 and Beyond
Filip Ekberg
 
Bubble in link list
Bubble in link listBubble in link list
Bubble in link list
university of Gujrat, pakistan
 
Number
NumberNumber
Number
mussawir20
 
Favor composition over inheritance
Favor composition over inheritanceFavor composition over inheritance
Favor composition over inheritance
Kochih Wu
 
Stack linked list
Stack linked listStack linked list
Stack linked list
bhargav0077
 
15b more gui
15b more gui15b more gui
DevFM #20 : SqlDatabaseCommand, un Simple Object Mapping Toolkit
DevFM #20 : SqlDatabaseCommand, un Simple Object Mapping ToolkitDevFM #20 : SqlDatabaseCommand, un Simple Object Mapping Toolkit
DevFM #20 : SqlDatabaseCommand, un Simple Object Mapping Toolkit
Denis Voituron
 
Deletion of an element at a given particular position
Deletion of an  element  at a given particular positionDeletion of an  element  at a given particular position
Deletion of an element at a given particular position
Kavya Shree
 
Vb.net programs
Vb.net programsVb.net programs
Software Design Thinking
Software Design ThinkingSoftware Design Thinking
Software Design Thinking
GeekNightHyderabad
 
Brief Introduction to Cython
Brief Introduction to CythonBrief Introduction to Cython
Brief Introduction to Cython
Aleksandar Jelenak
 
Crystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and Spark
Crystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and SparkCrystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and Spark
Crystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and Spark
Jivan Nepali
 
Why is a[1] fast than a.get(1)
Why is a[1]  fast than a.get(1)Why is a[1]  fast than a.get(1)
Why is a[1] fast than a.get(1)
kao kuo-tung
 
Stack push pop
Stack push popStack push pop
Stack push pop
A. S. M. Shafi
 
A useful tools in windows py2exe(optional)
A useful tools in windows py2exe(optional)A useful tools in windows py2exe(optional)
A useful tools in windows py2exe(optional)
John(Qiang) Zhang
 

What's hot (20)

Insert element position
Insert element positionInsert element position
Insert element position
 
Insertion operation
Insertion operationInsertion operation
Insertion operation
 
Grand Central Dispatch
Grand Central DispatchGrand Central Dispatch
Grand Central Dispatch
 
Data Visualization — Le funzionalità matematiche di Sage per la visualizzazio...
Data Visualization — Le funzionalità matematiche di Sage per la visualizzazio...Data Visualization — Le funzionalità matematiche di Sage per la visualizzazio...
Data Visualization — Le funzionalità matematiche di Sage per la visualizzazio...
 
Dynamically linked queues
Dynamically linked queuesDynamically linked queues
Dynamically linked queues
 
C# 8 and Beyond
C# 8 and BeyondC# 8 and Beyond
C# 8 and Beyond
 
Bubble in link list
Bubble in link listBubble in link list
Bubble in link list
 
Number
NumberNumber
Number
 
Favor composition over inheritance
Favor composition over inheritanceFavor composition over inheritance
Favor composition over inheritance
 
Stack linked list
Stack linked listStack linked list
Stack linked list
 
15b more gui
15b more gui15b more gui
15b more gui
 
DevFM #20 : SqlDatabaseCommand, un Simple Object Mapping Toolkit
DevFM #20 : SqlDatabaseCommand, un Simple Object Mapping ToolkitDevFM #20 : SqlDatabaseCommand, un Simple Object Mapping Toolkit
DevFM #20 : SqlDatabaseCommand, un Simple Object Mapping Toolkit
 
Deletion of an element at a given particular position
Deletion of an  element  at a given particular positionDeletion of an  element  at a given particular position
Deletion of an element at a given particular position
 
Vb.net programs
Vb.net programsVb.net programs
Vb.net programs
 
Software Design Thinking
Software Design ThinkingSoftware Design Thinking
Software Design Thinking
 
Brief Introduction to Cython
Brief Introduction to CythonBrief Introduction to Cython
Brief Introduction to Cython
 
Crystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and Spark
Crystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and SparkCrystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and Spark
Crystal Ball Event Prediction and Log Analysis with Hadoop MapReduce and Spark
 
Why is a[1] fast than a.get(1)
Why is a[1]  fast than a.get(1)Why is a[1]  fast than a.get(1)
Why is a[1] fast than a.get(1)
 
Stack push pop
Stack push popStack push pop
Stack push pop
 
A useful tools in windows py2exe(optional)
A useful tools in windows py2exe(optional)A useful tools in windows py2exe(optional)
A useful tools in windows py2exe(optional)
 

Viewers also liked

Brochure 2016 for email
Brochure 2016 for emailBrochure 2016 for email
Brochure 2016 for email
Richard Griffiths
 
ADVENTURES IN MISSION
ADVENTURES IN MISSIONADVENTURES IN MISSION
ADVENTURES IN MISSION
Dumsani Njobo Mamba
 
Trabajo
TrabajoTrabajo
Hypothesis presentation
Hypothesis presentationHypothesis presentation
Stephen Joseph Racik
Stephen Joseph RacikStephen Joseph Racik
Stephen Joseph Racik
shannondelman
 
EL CORAZÓN DELATOR Carmen Martínez
EL CORAZÓN DELATOR Carmen MartínezEL CORAZÓN DELATOR Carmen Martínez
EL CORAZÓN DELATOR Carmen Martínez
Universidad Politécnica Estatal del Carchi
 
RoadPiece_Freshman
RoadPiece_FreshmanRoadPiece_Freshman
RoadPiece_Freshman
Danielle Duvick
 
Global marketing
Global marketingGlobal marketing
Global marketing
Ronald M. Herber
 
Akshat Mathur- Architect
Akshat Mathur- ArchitectAkshat Mathur- Architect
Akshat Mathur- Architect
akshat mathur
 
(S) Managing the risks of using Social Media
(S) Managing the risks of using Social Media(S) Managing the risks of using Social Media
(S) Managing the risks of using Social Media
Adam Moodie
 
Bab 9 PEMBENTUKAN NEGARA PERSEKUTUAN AMERIKA SYARIKAT
Bab 9 PEMBENTUKAN NEGARA PERSEKUTUAN AMERIKA SYARIKATBab 9 PEMBENTUKAN NEGARA PERSEKUTUAN AMERIKA SYARIKAT
Bab 9 PEMBENTUKAN NEGARA PERSEKUTUAN AMERIKA SYARIKAT
Muhamad Saifullah
 

Viewers also liked (11)

Brochure 2016 for email
Brochure 2016 for emailBrochure 2016 for email
Brochure 2016 for email
 
ADVENTURES IN MISSION
ADVENTURES IN MISSIONADVENTURES IN MISSION
ADVENTURES IN MISSION
 
Trabajo
TrabajoTrabajo
Trabajo
 
Hypothesis presentation
Hypothesis presentationHypothesis presentation
Hypothesis presentation
 
Stephen Joseph Racik
Stephen Joseph RacikStephen Joseph Racik
Stephen Joseph Racik
 
EL CORAZÓN DELATOR Carmen Martínez
EL CORAZÓN DELATOR Carmen MartínezEL CORAZÓN DELATOR Carmen Martínez
EL CORAZÓN DELATOR Carmen Martínez
 
RoadPiece_Freshman
RoadPiece_FreshmanRoadPiece_Freshman
RoadPiece_Freshman
 
Global marketing
Global marketingGlobal marketing
Global marketing
 
Akshat Mathur- Architect
Akshat Mathur- ArchitectAkshat Mathur- Architect
Akshat Mathur- Architect
 
(S) Managing the risks of using Social Media
(S) Managing the risks of using Social Media(S) Managing the risks of using Social Media
(S) Managing the risks of using Social Media
 
Bab 9 PEMBENTUKAN NEGARA PERSEKUTUAN AMERIKA SYARIKAT
Bab 9 PEMBENTUKAN NEGARA PERSEKUTUAN AMERIKA SYARIKATBab 9 PEMBENTUKAN NEGARA PERSEKUTUAN AMERIKA SYARIKAT
Bab 9 PEMBENTUKAN NEGARA PERSEKUTUAN AMERIKA SYARIKAT
 

Similar to PyLecture2 -NetworkX-

Cluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in CCluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in C
Steffen Wenz
 
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
GeeksLab Odessa
 
python lab programs.pdf
python lab programs.pdfpython lab programs.pdf
python lab programs.pdf
CBJWorld
 
Swift for tensorflow
Swift for tensorflowSwift for tensorflow
Swift for tensorflow
규영 허
 
Machine learning with py torch
Machine learning with py torchMachine learning with py torch
Machine learning with py torch
Riza Fahmi
 
The Ring programming language version 1.5.3 book - Part 40 of 184
The Ring programming language version 1.5.3 book - Part 40 of 184The Ring programming language version 1.5.3 book - Part 40 of 184
The Ring programming language version 1.5.3 book - Part 40 of 184
Mahmoud Samir Fayed
 
Building a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxData
Building a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxDataBuilding a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxData
Building a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxData
InfluxData
 
How to Build a Telegraf Plugin by Noah Crowley
How to Build a Telegraf Plugin by Noah CrowleyHow to Build a Telegraf Plugin by Noah Crowley
How to Build a Telegraf Plugin by Noah Crowley
InfluxData
 
Introduction to Python.Net
Introduction to Python.NetIntroduction to Python.Net
Introduction to Python.Net
Stefan Schukat
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
Upender Upr
 
Computer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperComputer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paper
Deepak Singh
 
Apache Flink: API, runtime, and project roadmap
Apache Flink: API, runtime, and project roadmapApache Flink: API, runtime, and project roadmap
Apache Flink: API, runtime, and project roadmap
Kostas Tzoumas
 
Backdoor coding
Backdoor codingBackdoor coding
Backdoor coding
abdesslem amri
 
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
eugeniadean34240
 
The Ring programming language version 1.10 book - Part 39 of 212
The Ring programming language version 1.10 book - Part 39 of 212The Ring programming language version 1.10 book - Part 39 of 212
The Ring programming language version 1.10 book - Part 39 of 212
Mahmoud Samir Fayed
 
Functional Programming inside OOP? It’s possible with Python
Functional Programming inside OOP? It’s possible with PythonFunctional Programming inside OOP? It’s possible with Python
Functional Programming inside OOP? It’s possible with Python
Carlos V.
 
Numba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPyNumba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPy
Travis Oliphant
 
Iron python
Iron pythonIron python
Iron python
GeorgeIshak
 
Python na Infraestrutura 
MySQL do Facebook

Python na Infraestrutura 
MySQL do Facebook
Python na Infraestrutura 
MySQL do Facebook

Python na Infraestrutura 
MySQL do Facebook

Artur Rodrigues
 
Creating sub zero dashboard plugin for apex with google
Creating sub zero dashboard plugin for apex with googleCreating sub zero dashboard plugin for apex with google
Creating sub zero dashboard plugin for apex with google
Roel Hartman
 

Similar to PyLecture2 -NetworkX- (20)

Cluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in CCluj.py Meetup: Extending Python in C
Cluj.py Meetup: Extending Python in C
 
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
Java/Scala Lab: Анатолий Кметюк - Scala SubScript: Алгебра для реактивного пр...
 
python lab programs.pdf
python lab programs.pdfpython lab programs.pdf
python lab programs.pdf
 
Swift for tensorflow
Swift for tensorflowSwift for tensorflow
Swift for tensorflow
 
Machine learning with py torch
Machine learning with py torchMachine learning with py torch
Machine learning with py torch
 
The Ring programming language version 1.5.3 book - Part 40 of 184
The Ring programming language version 1.5.3 book - Part 40 of 184The Ring programming language version 1.5.3 book - Part 40 of 184
The Ring programming language version 1.5.3 book - Part 40 of 184
 
Building a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxData
Building a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxDataBuilding a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxData
Building a Telegraf Plugin by Noah Crowly | Developer Advocate | InfluxData
 
How to Build a Telegraf Plugin by Noah Crowley
How to Build a Telegraf Plugin by Noah CrowleyHow to Build a Telegraf Plugin by Noah Crowley
How to Build a Telegraf Plugin by Noah Crowley
 
Introduction to Python.Net
Introduction to Python.NetIntroduction to Python.Net
Introduction to Python.Net
 
Java Simple Programs
Java Simple ProgramsJava Simple Programs
Java Simple Programs
 
Computer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paperComputer science-2010-cbse-question-paper
Computer science-2010-cbse-question-paper
 
Apache Flink: API, runtime, and project roadmap
Apache Flink: API, runtime, and project roadmapApache Flink: API, runtime, and project roadmap
Apache Flink: API, runtime, and project roadmap
 
Backdoor coding
Backdoor codingBackdoor coding
Backdoor coding
 
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
20145-5SumII_CSC407_assign1.htmlCSC 407 Computer Systems II.docx
 
The Ring programming language version 1.10 book - Part 39 of 212
The Ring programming language version 1.10 book - Part 39 of 212The Ring programming language version 1.10 book - Part 39 of 212
The Ring programming language version 1.10 book - Part 39 of 212
 
Functional Programming inside OOP? It’s possible with Python
Functional Programming inside OOP? It’s possible with PythonFunctional Programming inside OOP? It’s possible with Python
Functional Programming inside OOP? It’s possible with Python
 
Numba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPyNumba: Array-oriented Python Compiler for NumPy
Numba: Array-oriented Python Compiler for NumPy
 
Iron python
Iron pythonIron python
Iron python
 
Python na Infraestrutura 
MySQL do Facebook

Python na Infraestrutura 
MySQL do Facebook
Python na Infraestrutura 
MySQL do Facebook

Python na Infraestrutura 
MySQL do Facebook

 
Creating sub zero dashboard plugin for apex with google
Creating sub zero dashboard plugin for apex with googleCreating sub zero dashboard plugin for apex with google
Creating sub zero dashboard plugin for apex with google
 

More from Yoshiki Satotani

Basic practice of R
Basic practice of RBasic practice of R
Basic practice of R
Yoshiki Satotani
 
Basic use of Python (Practice)
Basic use of Python (Practice)Basic use of Python (Practice)
Basic use of Python (Practice)
Yoshiki Satotani
 
Basic use of Python
Basic use of PythonBasic use of Python
Basic use of Python
Yoshiki Satotani
 
Py lecture5 python plots
Py lecture5 python plotsPy lecture5 python plots
Py lecture5 python plots
Yoshiki Satotani
 
PyLecture4 -Python Basics2-
PyLecture4 -Python Basics2-PyLecture4 -Python Basics2-
PyLecture4 -Python Basics2-
Yoshiki Satotani
 
PyLecture1 -Python Basics-
PyLecture1 -Python Basics-PyLecture1 -Python Basics-
PyLecture1 -Python Basics-
Yoshiki Satotani
 
PyLecture3 -json-
PyLecture3 -json-PyLecture3 -json-
PyLecture3 -json-
Yoshiki Satotani
 

More from Yoshiki Satotani (7)

Basic practice of R
Basic practice of RBasic practice of R
Basic practice of R
 
Basic use of Python (Practice)
Basic use of Python (Practice)Basic use of Python (Practice)
Basic use of Python (Practice)
 
Basic use of Python
Basic use of PythonBasic use of Python
Basic use of Python
 
Py lecture5 python plots
Py lecture5 python plotsPy lecture5 python plots
Py lecture5 python plots
 
PyLecture4 -Python Basics2-
PyLecture4 -Python Basics2-PyLecture4 -Python Basics2-
PyLecture4 -Python Basics2-
 
PyLecture1 -Python Basics-
PyLecture1 -Python Basics-PyLecture1 -Python Basics-
PyLecture1 -Python Basics-
 
PyLecture3 -json-
PyLecture3 -json-PyLecture3 -json-
PyLecture3 -json-
 

PyLecture2 -NetworkX-

  • 1.
  • 2.  Basic Python › Data types(Integer, String, List) › Control flow statements › List comprehension
  • 3.  Import NetworkX import networkx as nx  Generating a graph G = nx.Graph()  Adding a node G.add_node(“one”)  Adding nodes G.add_nodes_from([“two”, “three”])  Adding an edge G.add_edge(“one”, “two”)  Adding edges G.add_edges_from([(“two”, “three”), (“three”, “one”)])
  • 4. import matplotlib.pyplot as plt nx.draw(G) plt.show()
  • 5.  Path graphs › G = nx.path_graph(40)  Cycle graphs › G = nx.cycle_graph(40)  Complete graphs › G = nx.complete_graph(40)  2D grid graphs › G = nx.grid_2d_graph(5, 4)  Random graphs › G = nx.erdos_renyi_graph(20, 0.3) › G = nx.barabasi_albert_graph(100, 5)
  • 6.
  • 7.  The number of degrees › len(G.nodes())  The number of edges › len(G.edges())  Average degree › 2 * len(G.edges()) / len(G.nodes())  Average path length › Gsub = nx.connected_component_subgraphs(G)[0] › nx.average_shortest_path_length(G)  Network density › nx.density(G)
  • 8. deg = [nx.degree(G,n) for n in G.nodes()] hist = [0 for i in range(max(deg)+1)] for d in deg: hist[d] += 1 plt.plot(range(len(hist)), hist, "or") plt.show()
  • 9.
  • 10.  Go to http://apps.twitter.com and create your app . › You will get API Key, API Secret, Access Token, and Access Token Secret.  Installing tweepy › pip install tweepy
  • 11.  Next, many, many lines of python code  You can get the python script(named Tweepy1.py) at https://codebreak.com/git/arity/TweepyTutori al/tree/master/
  • 12. import time import tweepy # Copy the api key, the api secret, the access token and the access # token secret from the relevant page on your Twitter app api_key = ‘your_api_key_here' api_secret = ‘your_api_secret_here’ access_token = ‘your_access_token_here' access_token_secret = ‘your_access_token_secret_here' # You don't need to make any changes below here # This bit authorises you to ask for information from Twitter auth = tweepy.OAuthHandler(api_key, api_secret) auth.set_access_token(access_token, access_token_secret) # The api object gives you access to all of the http calls that Twitter accepts api = tweepy.API(auth)
  • 13. def fib(n,user,network): if n>0: time.sleep(40) try: users=api.followers(user) except tweepy.TweepError: return for follower in users: network.add_node(follower.screen_name) network.add_edge(follower.screen_name, user) fib(n-1,follower.screen_name,network)
  • 14. #Then, There is a directed graph G = nx.DiGraph() #User we want to use as initial node user='GitHub‘ G.add_node(user) n=2 fib(n,user,G) nx.draw(G) plt.show()
  • 15.
  • 16.  Graph manipulating functions › Adding nodes, edges  Many types of network  Many network characteristics