SlideShare a Scribd company logo
1 of 34
Download to read offline
NETWORK ANALYSIS IN PYTHON I
Introduction
to networks
Network Analysis in Python I
Networks!
● Examples:
● Social
● Transportation
● Model relationships between entities
Network Analysis in Python I
Networks!
● Insights:
● Important entities: influencers in social network
● Pathfinding: most efficient transport path
● Clustering: finding communities
Network Analysis in Python I
Network structure
Node
Node
Edge
Graph
Network Analysis in Python I
Network structure
Hugo:
id: 1,
age: 34
Friendship:
date: 2016-05-21
Social
Graph
Eric:
id: 2,
age: 29
Network Analysis in Python I
NetworkX API basics
In [1]: import networkx as nx
In [2]: G = nx.Graph()
In [4]: G.add_nodes_from([1, 2, 3])
In [5]: G.nodes()
Out[5]: [1, 2, 3]
In [6]: G.add_edge(1, 2)
In [7]: G.edges()
Out[7]: [(1, 2)]
Network Analysis in Python I
NetworkX API basics
In [8]: G.node[1]['label'] = 'blue'
In [9]: G.nodes(data=True)
Out[9]: [(1, {'label': 'blue'}), (2, {}), (3, {})]
Network Analysis in Python I
NetworkX API basics
In [10]: nx.draw(G)
In [11]: import matplotlib.pyplot as plt
In [12]: plt.show()
NETWORK ANALYSIS IN PYTHON I
Let’s practice!
NETWORK ANALYSIS IN PYTHON
Types of graphs
Network Analysis in Python I
● Facebook social graph
Undirected graphs
Network Analysis in Python I
Undirected graphs
In [1]: import networkx as nx
In [2]: G = nx.Graph()
In [3]: type(G)
Out[3]: networkx.classes.graph.Graph
Network Analysis in Python I
● Directed: Twi er social graph
Directed graphs
Network Analysis in Python I
Directed graphs
In [4]: D = nx.DiGraph()
In [5]: type(D)
Out[5]: networkx.classes.digraph.DiGraph
Network Analysis in Python I
● Multi(Di)Graph: Trip records between bike sharing stations
Types of graphs
Network Analysis in Python I
Multi-edge (Directed) graphs
In [6]: M = nx.MultiGraph()
In [7]: type(M)
Out[7]: networkx.classes.multigraph.MultiGraph
In [8]: MD = nx.MultiDiGraph()
In [9]: type(MD)
Out[9]: networkx.classes.multidigraph.MultiDiGraph
Network Analysis in Python I
● Edges can contain weights
Weights on graphs
3
Network Analysis in Python I
● Nodes that are connected to themselves
Self-loops
NETWORK ANALYSIS IN PYTHON I
Let’s practice!
NETWORK ANALYSIS IN PYTHON I
Network
visualization
Network Analysis in Python I
Irrational vs. Rational visualizations
Network Analysis in Python I
Visualizing networks
● Matrix plots
● Arc plots
● Circos plots
Network Analysis in Python I
Visualizing networks
● Matrix plots
● Arc plots
● Circos plots
Network Analysis in Python I
Matrix plot
A B C
A
B
C
A
B
C
Network Analysis in Python I
Matrix plot
A B C
A
B
C
A
B
C
Network Analysis in Python I
Matrix plot
A B C
A
B
C
A
B
C
Network Analysis in Python I
Matrix plot
A B C
A
B
C
A
B
C
Network Analysis in Python I
Directed matrices
A B C
A
B
C
A
B
C
Network Analysis in Python I
Visualizing networks
● Matrix Plots
● Arc Plots
● Circos Plots
Network Analysis in Python I
Arc plot
A B C
A
B
C
ordered axis
Network Analysis in Python I
Visualizing networks
● Matrix Plots
● Arc Plots
● Circos Plots
Network Analysis in Python I
Circos plot
A
C
B
D
E
F
A
C
B
D
E
F
Network Analysis in Python I
nxviz API
In [1]: import nxviz as nv
In [2]: import matplotlib.pyplot as plt
In [3]: ap = nv.ArcPlot(G)
In [4]: ap.draw()
In [5]: plt.show()
NETWORK ANALYSIS IN PYTHON I
Let’s practice!

More Related Content

What's hot

Profiling Java Programs for Parallelism
Profiling Java Programs for ParallelismProfiling Java Programs for Parallelism
Profiling Java Programs for ParallelismDmitry Anisimov
 
Internet Technologies (October – 2014 ) [Question Paper | CBSGS: 75:25 Pattern]
Internet Technologies (October – 2014 ) [Question Paper | CBSGS: 75:25 Pattern]Internet Technologies (October – 2014 ) [Question Paper | CBSGS: 75:25 Pattern]
Internet Technologies (October – 2014 ) [Question Paper | CBSGS: 75:25 Pattern]Mumbai B.Sc.IT Study
 
Internet Technologies (May - 2018) [IDOL - Revised Course | Question Paper]
Internet Technologies (May - 2018) [IDOL - Revised Course | Question Paper]Internet Technologies (May - 2018) [IDOL - Revised Course | Question Paper]
Internet Technologies (May - 2018) [IDOL - Revised Course | Question Paper]Mumbai B.Sc.IT Study
 
Community detection in graphs with NetworKit
Community detection in graphs with NetworKitCommunity detection in graphs with NetworKit
Community detection in graphs with NetworKitBenj Pettit
 
Internet Technologies (May - 2018) [IDOL - Old Course | Question Paper]
Internet Technologies (May - 2018) [IDOL - Old Course | Question Paper]Internet Technologies (May - 2018) [IDOL - Old Course | Question Paper]
Internet Technologies (May - 2018) [IDOL - Old Course | Question Paper]Mumbai B.Sc.IT Study
 
Provenance Analytics at AAAI Human Computation Conference 2013
Provenance Analytics at AAAI Human Computation Conference 2013Provenance Analytics at AAAI Human Computation Conference 2013
Provenance Analytics at AAAI Human Computation Conference 2013T Dong Huynh
 
2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...
2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...
2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...Monica Sabharwal
 

What's hot (9)

Protocol layering quiz
Protocol layering quizProtocol layering quiz
Protocol layering quiz
 
Profiling Java Programs for Parallelism
Profiling Java Programs for ParallelismProfiling Java Programs for Parallelism
Profiling Java Programs for Parallelism
 
Internet Technologies (October – 2014 ) [Question Paper | CBSGS: 75:25 Pattern]
Internet Technologies (October – 2014 ) [Question Paper | CBSGS: 75:25 Pattern]Internet Technologies (October – 2014 ) [Question Paper | CBSGS: 75:25 Pattern]
Internet Technologies (October – 2014 ) [Question Paper | CBSGS: 75:25 Pattern]
 
Internet Technologies (May - 2018) [IDOL - Revised Course | Question Paper]
Internet Technologies (May - 2018) [IDOL - Revised Course | Question Paper]Internet Technologies (May - 2018) [IDOL - Revised Course | Question Paper]
Internet Technologies (May - 2018) [IDOL - Revised Course | Question Paper]
 
Community detection in graphs with NetworKit
Community detection in graphs with NetworKitCommunity detection in graphs with NetworKit
Community detection in graphs with NetworKit
 
Internet Technologies (May - 2018) [IDOL - Old Course | Question Paper]
Internet Technologies (May - 2018) [IDOL - Old Course | Question Paper]Internet Technologies (May - 2018) [IDOL - Old Course | Question Paper]
Internet Technologies (May - 2018) [IDOL - Old Course | Question Paper]
 
Provenance Analytics at AAAI Human Computation Conference 2013
Provenance Analytics at AAAI Human Computation Conference 2013Provenance Analytics at AAAI Human Computation Conference 2013
Provenance Analytics at AAAI Human Computation Conference 2013
 
2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...
2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...
2009 Punjab Technical University B.C.A Object Oriented Proagramming Language ...
 
Sci computing using python
Sci computing using pythonSci computing using python
Sci computing using python
 

Similar to Analyze networks in Python

Modeling the Impact of R & Python Packages: Dependency and Contributor Networks
Modeling the Impact of R & Python Packages: Dependency and Contributor NetworksModeling the Impact of R & Python Packages: Dependency and Contributor Networks
Modeling the Impact of R & Python Packages: Dependency and Contributor NetworksMelissa Moody
 
Graph Analyses with Python and NetworkX
Graph Analyses with Python and NetworkXGraph Analyses with Python and NetworkX
Graph Analyses with Python and NetworkXBenjamin Bengfort
 
Graph Centric Analysis of Road Network Patterns for CBD’s of Metropolitan Cit...
Graph Centric Analysis of Road Network Patterns for CBD’s of Metropolitan Cit...Graph Centric Analysis of Road Network Patterns for CBD’s of Metropolitan Cit...
Graph Centric Analysis of Road Network Patterns for CBD’s of Metropolitan Cit...Punit Sharnagat
 
A comparative study of social network analysis tools
A comparative study of social network analysis toolsA comparative study of social network analysis tools
A comparative study of social network analysis toolsDavid Combe
 
Introduction to Graph neural networks @ Vienna Deep Learning meetup
Introduction to Graph neural networks @  Vienna Deep Learning meetupIntroduction to Graph neural networks @  Vienna Deep Learning meetup
Introduction to Graph neural networks @ Vienna Deep Learning meetupLiad Magen
 
An Empirical Comparison of Knowledge Graph Embeddings for Item Recommendation
An Empirical Comparison of Knowledge Graph Embeddings for Item RecommendationAn Empirical Comparison of Knowledge Graph Embeddings for Item Recommendation
An Empirical Comparison of Knowledge Graph Embeddings for Item RecommendationEnrico Palumbo
 
MediaEval 2016 - MLPBOON Predicting Media Interestingness System
MediaEval 2016 - MLPBOON Predicting Media Interestingness SystemMediaEval 2016 - MLPBOON Predicting Media Interestingness System
MediaEval 2016 - MLPBOON Predicting Media Interestingness Systemmultimediaeval
 
Ego net facebook data analysis
Ego net facebook data analysisEgo net facebook data analysis
Ego net facebook data analysisSamsil Arefin
 
Research on Stability of Software Structure Based On Design Patterns
Research on Stability of Software Structure Based On Design PatternsResearch on Stability of Software Structure Based On Design Patterns
Research on Stability of Software Structure Based On Design PatternsIJRES Journal
 
Visual Search and Question Answering II
Visual Search and Question Answering IIVisual Search and Question Answering II
Visual Search and Question Answering IIWanjin Yu
 
Network Analyzer and Report Generation Tool for NS-2 using TCL Script
Network Analyzer and Report Generation Tool for NS-2 using TCL ScriptNetwork Analyzer and Report Generation Tool for NS-2 using TCL Script
Network Analyzer and Report Generation Tool for NS-2 using TCL ScriptIRJET Journal
 
cs224w-79-final
cs224w-79-finalcs224w-79-final
cs224w-79-finalDarren Koh
 
La bi, l'informatique décisionnelle et les graphes
La bi, l'informatique décisionnelle et les graphesLa bi, l'informatique décisionnelle et les graphes
La bi, l'informatique décisionnelle et les graphesCédric Fauvet
 
MuCon 2019: Exploring Your Microservices Architecture Through Network Science...
MuCon 2019: Exploring Your Microservices Architecture Through Network Science...MuCon 2019: Exploring Your Microservices Architecture Through Network Science...
MuCon 2019: Exploring Your Microservices Architecture Through Network Science...OpenCredo
 
Social Network Analysis and Visualization
Social Network Analysis and VisualizationSocial Network Analysis and Visualization
Social Network Analysis and VisualizationAlberto Ramirez
 
EVOLUTIONARY CENTRALITY AND MAXIMAL CLIQUES IN MOBILE SOCIAL NETWORKS
EVOLUTIONARY CENTRALITY AND MAXIMAL CLIQUES IN MOBILE SOCIAL NETWORKSEVOLUTIONARY CENTRALITY AND MAXIMAL CLIQUES IN MOBILE SOCIAL NETWORKS
EVOLUTIONARY CENTRALITY AND MAXIMAL CLIQUES IN MOBILE SOCIAL NETWORKSijcsit
 
Complex Networks Analysis @ Universita Roma Tre
Complex Networks Analysis @ Universita Roma TreComplex Networks Analysis @ Universita Roma Tre
Complex Networks Analysis @ Universita Roma TreMatteo Moci
 
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....ArangoDB Database
 

Similar to Analyze networks in Python (20)

Python networkx library quick start guide
Python networkx library quick start guidePython networkx library quick start guide
Python networkx library quick start guide
 
Modeling the Impact of R & Python Packages: Dependency and Contributor Networks
Modeling the Impact of R & Python Packages: Dependency and Contributor NetworksModeling the Impact of R & Python Packages: Dependency and Contributor Networks
Modeling the Impact of R & Python Packages: Dependency and Contributor Networks
 
Graph Analyses with Python and NetworkX
Graph Analyses with Python and NetworkXGraph Analyses with Python and NetworkX
Graph Analyses with Python and NetworkX
 
Graph Centric Analysis of Road Network Patterns for CBD’s of Metropolitan Cit...
Graph Centric Analysis of Road Network Patterns for CBD’s of Metropolitan Cit...Graph Centric Analysis of Road Network Patterns for CBD’s of Metropolitan Cit...
Graph Centric Analysis of Road Network Patterns for CBD’s of Metropolitan Cit...
 
A comparative study of social network analysis tools
A comparative study of social network analysis toolsA comparative study of social network analysis tools
A comparative study of social network analysis tools
 
Introduction to Graph neural networks @ Vienna Deep Learning meetup
Introduction to Graph neural networks @  Vienna Deep Learning meetupIntroduction to Graph neural networks @  Vienna Deep Learning meetup
Introduction to Graph neural networks @ Vienna Deep Learning meetup
 
An Empirical Comparison of Knowledge Graph Embeddings for Item Recommendation
An Empirical Comparison of Knowledge Graph Embeddings for Item RecommendationAn Empirical Comparison of Knowledge Graph Embeddings for Item Recommendation
An Empirical Comparison of Knowledge Graph Embeddings for Item Recommendation
 
Portfolio
PortfolioPortfolio
Portfolio
 
MediaEval 2016 - MLPBOON Predicting Media Interestingness System
MediaEval 2016 - MLPBOON Predicting Media Interestingness SystemMediaEval 2016 - MLPBOON Predicting Media Interestingness System
MediaEval 2016 - MLPBOON Predicting Media Interestingness System
 
Ego net facebook data analysis
Ego net facebook data analysisEgo net facebook data analysis
Ego net facebook data analysis
 
Research on Stability of Software Structure Based On Design Patterns
Research on Stability of Software Structure Based On Design PatternsResearch on Stability of Software Structure Based On Design Patterns
Research on Stability of Software Structure Based On Design Patterns
 
Visual Search and Question Answering II
Visual Search and Question Answering IIVisual Search and Question Answering II
Visual Search and Question Answering II
 
Network Analyzer and Report Generation Tool for NS-2 using TCL Script
Network Analyzer and Report Generation Tool for NS-2 using TCL ScriptNetwork Analyzer and Report Generation Tool for NS-2 using TCL Script
Network Analyzer and Report Generation Tool for NS-2 using TCL Script
 
cs224w-79-final
cs224w-79-finalcs224w-79-final
cs224w-79-final
 
La bi, l'informatique décisionnelle et les graphes
La bi, l'informatique décisionnelle et les graphesLa bi, l'informatique décisionnelle et les graphes
La bi, l'informatique décisionnelle et les graphes
 
MuCon 2019: Exploring Your Microservices Architecture Through Network Science...
MuCon 2019: Exploring Your Microservices Architecture Through Network Science...MuCon 2019: Exploring Your Microservices Architecture Through Network Science...
MuCon 2019: Exploring Your Microservices Architecture Through Network Science...
 
Social Network Analysis and Visualization
Social Network Analysis and VisualizationSocial Network Analysis and Visualization
Social Network Analysis and Visualization
 
EVOLUTIONARY CENTRALITY AND MAXIMAL CLIQUES IN MOBILE SOCIAL NETWORKS
EVOLUTIONARY CENTRALITY AND MAXIMAL CLIQUES IN MOBILE SOCIAL NETWORKSEVOLUTIONARY CENTRALITY AND MAXIMAL CLIQUES IN MOBILE SOCIAL NETWORKS
EVOLUTIONARY CENTRALITY AND MAXIMAL CLIQUES IN MOBILE SOCIAL NETWORKS
 
Complex Networks Analysis @ Universita Roma Tre
Complex Networks Analysis @ Universita Roma TreComplex Networks Analysis @ Universita Roma Tre
Complex Networks Analysis @ Universita Roma Tre
 
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
 

Recently uploaded

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 

Recently uploaded (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 

Analyze networks in Python

  • 1. NETWORK ANALYSIS IN PYTHON I Introduction to networks
  • 2. Network Analysis in Python I Networks! ● Examples: ● Social ● Transportation ● Model relationships between entities
  • 3. Network Analysis in Python I Networks! ● Insights: ● Important entities: influencers in social network ● Pathfinding: most efficient transport path ● Clustering: finding communities
  • 4. Network Analysis in Python I Network structure Node Node Edge Graph
  • 5. Network Analysis in Python I Network structure Hugo: id: 1, age: 34 Friendship: date: 2016-05-21 Social Graph Eric: id: 2, age: 29
  • 6. Network Analysis in Python I NetworkX API basics In [1]: import networkx as nx In [2]: G = nx.Graph() In [4]: G.add_nodes_from([1, 2, 3]) In [5]: G.nodes() Out[5]: [1, 2, 3] In [6]: G.add_edge(1, 2) In [7]: G.edges() Out[7]: [(1, 2)]
  • 7. Network Analysis in Python I NetworkX API basics In [8]: G.node[1]['label'] = 'blue' In [9]: G.nodes(data=True) Out[9]: [(1, {'label': 'blue'}), (2, {}), (3, {})]
  • 8. Network Analysis in Python I NetworkX API basics In [10]: nx.draw(G) In [11]: import matplotlib.pyplot as plt In [12]: plt.show()
  • 9. NETWORK ANALYSIS IN PYTHON I Let’s practice!
  • 10. NETWORK ANALYSIS IN PYTHON Types of graphs
  • 11. Network Analysis in Python I ● Facebook social graph Undirected graphs
  • 12. Network Analysis in Python I Undirected graphs In [1]: import networkx as nx In [2]: G = nx.Graph() In [3]: type(G) Out[3]: networkx.classes.graph.Graph
  • 13. Network Analysis in Python I ● Directed: Twi er social graph Directed graphs
  • 14. Network Analysis in Python I Directed graphs In [4]: D = nx.DiGraph() In [5]: type(D) Out[5]: networkx.classes.digraph.DiGraph
  • 15. Network Analysis in Python I ● Multi(Di)Graph: Trip records between bike sharing stations Types of graphs
  • 16. Network Analysis in Python I Multi-edge (Directed) graphs In [6]: M = nx.MultiGraph() In [7]: type(M) Out[7]: networkx.classes.multigraph.MultiGraph In [8]: MD = nx.MultiDiGraph() In [9]: type(MD) Out[9]: networkx.classes.multidigraph.MultiDiGraph
  • 17. Network Analysis in Python I ● Edges can contain weights Weights on graphs 3
  • 18. Network Analysis in Python I ● Nodes that are connected to themselves Self-loops
  • 19. NETWORK ANALYSIS IN PYTHON I Let’s practice!
  • 20. NETWORK ANALYSIS IN PYTHON I Network visualization
  • 21. Network Analysis in Python I Irrational vs. Rational visualizations
  • 22. Network Analysis in Python I Visualizing networks ● Matrix plots ● Arc plots ● Circos plots
  • 23. Network Analysis in Python I Visualizing networks ● Matrix plots ● Arc plots ● Circos plots
  • 24. Network Analysis in Python I Matrix plot A B C A B C A B C
  • 25. Network Analysis in Python I Matrix plot A B C A B C A B C
  • 26. Network Analysis in Python I Matrix plot A B C A B C A B C
  • 27. Network Analysis in Python I Matrix plot A B C A B C A B C
  • 28. Network Analysis in Python I Directed matrices A B C A B C A B C
  • 29. Network Analysis in Python I Visualizing networks ● Matrix Plots ● Arc Plots ● Circos Plots
  • 30. Network Analysis in Python I Arc plot A B C A B C ordered axis
  • 31. Network Analysis in Python I Visualizing networks ● Matrix Plots ● Arc Plots ● Circos Plots
  • 32. Network Analysis in Python I Circos plot A C B D E F A C B D E F
  • 33. Network Analysis in Python I nxviz API In [1]: import nxviz as nv In [2]: import matplotlib.pyplot as plt In [3]: ap = nv.ArcPlot(G) In [4]: ap.draw() In [5]: plt.show()
  • 34. NETWORK ANALYSIS IN PYTHON I Let’s practice!