Add to Watchlist

NetworkX Visualization Powered by Bokeh

1,371 views

Citation of segment
Embed Code
Purchasing a DVD Cite video

Formal Metadata

Title NetworkX Visualization Powered by Bokeh
Title of Series EuroPython 2016
Part Number 157
Number of Parts 169
Author Meier, Björn
License CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this license.
DOI 10.5446/21112
Publisher EuroPython
Release Date 2016
Language English

Content Metadata

Subject Area Computer Science
Abstract Björn Meier - NetworkX Visualization Powered by Bokeh Visual data exploration, e.g. of social networks, can be ugly manual work. The talk will be an introduction for the combined usage of NetworkX and Bokeh in a Jupyter Notebook to show how easy interactive network visualization can be. ----- During some work with social network analysis my favoured tool to study the networks was NetworkX. It provides a wide set of features and algorithms for network analysis, all in Python. But the functionality to visualize networks is not very strong and not to mention the missing interactive manipulation. However during the exploration of data: exporting, feeding an extra tool for visualization and then manipulating data manually was a tedious workflow. As I also had the optional target of presenting networks in a browser, I improved this workflow by creating a Flask web application providing interfaces to my networks. On the browser side I created a javascript client based on D3.js. In retrospective the required programming effort in Python and also in Javascript was too much for such a task. And exactly this target, interactive visualization in a browser (and as bonus in a Jupyter Notebook), can be achieved quiet easy now with Bokeh. The talk will be a step by step introduction, starting with the basic visualization of a network using Bokeh, NetworkX and a Jupyter Notebook. Next, how to create interactions with your network which will be used to change a network structure, e.g. a leaving person. As we want to see directly the impact of these changes in a network I will finally show how to update networks and visualize directly how the importance of the remaining people changes. And all this can be achieved with Python and maybe a bit of Javascript.
Series
Annotations
Transcript
Loading...
and here know this is on the the the only way to do it you the comfortable has become like it talks about his views on the something about groups of the and how it can be a lot of words used if there is no support in the area of the with plot of on what the united Jerusalem into you I don't use this all alright it's just projects at the moment it's not you know companies yeah that's so most of you may you talk about you know this is so you so you know most people know what he was great visualize visualizing library and yet at the same basic so you can have the data and related you can go in and change something that is so why don't you do this you must use this scientists working with networks of some kind of social work so I wanted to explore that and what most wanted to see you want more than just the columns to read and all so we wanted to visualize the properties so we wanted to see are also maybe 1 in 10 to the internet and I came up with natural properties and is the latest and usually usually is read it some nice solution was but you know I was told was extremely complicated but it's so it was be in the database in actually must the school last year so it's not always and not all of the program is just the to some visualization and so the question was can we do this of course you did what you can so a friend of mine minded needs so there's this to will appear you can look at it and I was thinking I try same knowledge the library and it's much easier so advise and I didn't have to handle any telescope called a moment to not have to to kill called where get the data to the client running my browser doing this me and I also can explore start my my visualization visualization in the novel in nature but not and this is really great and on top of this I can change and and that's I can change my graph we can manipulate it an I account text like so if I select something I you can get this vector so I did not show you how it's done so I will create a network of a short to you and all the code part of this slide so I did not let any part of at the end of a more complex example of there maybe but you see all what is necessary so I need some example data so I was in about using phone usually so sample data like set out there was something like this but yesterday I here so we have Europe rising and people like to use Twitter this summarized Twitter modules like so you used get the
information from the user Europe and now using your pleasant and sometimes is linked to a lot of people in all the users replies something some other people so we can create uses data victory some kind of social networks so all those are connected to each other maybe that to more so they the rate on an edge might be higher so this will be useful for network so I have my data what is the next step yes unit so as a sadly at the moment computers and supported protocols but we can do it only so we use network expand the of European Europe your pricing data I could have done it like here but I also look the front of to and limits so FIL having the wife isolated moderate-size started in the gym find so it created the network using that would extend the person also function to write its own team as far as I know importance for that and I get my network why do now and network it's can draw but it usually draws was not published and study so I can use the layoff from that but it's to create a layout and I can use this layout to fill in became and there can a threat to get an interactive visualization so I put in my network but put some values in for k case just say it's all on much of what you are and how much distance what you have achieved some notes that and it's an iterative of um and so I can say some and number of iterations if you know a little bit more interesting what exactly does you can go on the 1st Wikipedia page was directed graph drawing and
so what is the basic task is create spring forces between nodes and then you have this review model and put it on a table and then it tries and the few durations to get rid of the friction and then you have your notes on some positions of this is basically a spring layout of course directed graph drawing I will use this layout no all later and now we have to do some work around the world around you have to get the data in the form of we can use in and the cornerstone of a case usually I would say it's a common dataset and so that's 1 kind of I think 3 or 4 and data sources but I think it's the most important that's the 1 you probably would uh what was the 1st so it's a class we can store data hollandaise so you see on the left there's an idea of course because they're usually all this year and I stopped there Vieques coordination BY coordination and the node name so the 1st row says that the purity it's my Twitter handle is located at the position 21 Street and the nice thing about this kind data so as you can changes you can add today that you can add columns and you can see uh and change it and you will also get effects that so if
someone selected nodes in your graph this is the point where you get information about which a node is selected so you can use a lot of the you can tuples you can use ponders data frames to create close this but at that point usually have a directory and dictionary for us and so we have to do a little bit of transforming the data and this is a drawback of moments you have to copy the data so I get the layout of the
items so that you know and the layout is usually the not name and the optimal node name the value of of tuple of coordinates of the nodes so we have to extract the values and then we
have to put them in list so that we can trade our common data so so just expect them to the user and may use them in the dictionary put it back in the current status of so now we have so so now we can finally plot something understand and use lubricant called you can ignore 1st were
coded by just look at the the coupled together just creates you're trying and storing area so you defined on whole a bigger that is to say something about to say which tools you want so 10 means you can click on who is now the will approve of so that you move your mouse above nautical show name because I know that I have the common name in my datasets and also the right you already index this is uh it's a property which is almost always
there and then you've all will below it and you will see the idea in the name of a people of a of a node the next step this I want to see my circles and this was done by plot circle it would generate words would create a renderer it's the outside of the cell cycle and around and now I put my data sources in here so you say so this my notes and now I want to explain why some heuristics and why so I say and the 1st is the economy x and the common man wife and they will be used for the position of the circles and they have some fixed so useful color blue and forever and level it just means it's about the lines later and it's sites so we have now this considering that were just points OK so need some more work it's not so much but we have to add some matches and 2 at the edges we have to prepare the and so on just take the layout of and the network and the
extract the positions of the notes again because we want to connect nodes and what we do in here I get the data all of the edges so if a state network edges and data just through I would get the edges and the great participated tribute for a reaction and now calculate the maximum weight because I want you to do some of the coloring of the lines and so I can calculate a value between 0 . 1 and 0 . 6 and I put all of this and lists of dictionary and those that I can put back into a common data service for the arches and now again alliances yes nor can plot modular lines and I do the same so called I put in the source and cite the source the light sources and I say for the 1st point of every line so now you tuples in those 1st 2 lists line is defined by article IX Y for starting point x y for the end points so expressed this usually the starting point y as of the end point and this persistent just name for the columns and here you see already that we use for all of the the name that's all 1st so the other the users from becoming data sources and locate cannot see it directly here but usually the lines of different coloring of you maybe see later a little bit better OK so this was just boring and we want to see a little more we want to see some properties like I said sensuality or maybe clusters so the at the most information to our commentator cells and it's not too complicated so that would provide some really cool algorithms so you can use for example
multiple centrality utterances I have to new between a security just means that know what red so you have shortest paths in your network and node relative shortest paths have to cross who has a high betweeness centrality and now I have a centrality again it's addictive you have to transform a deliberate and I can use it and put it in the values that shift and that into range so I want to use this value for the size of the so so I say OK these department are have the 5 7 and the most important maybe 17 that's just that's just the mayor arrangement in and I say OK when you column from
a common data space this centrality and I added to my knowledge source so my notes so this is not for every node has centrality value dresses OK so the next point is that I want to have some clustering so rich knowledge people or maybe a little bit too connected because they
had been cheated on board and each other so are you was high somewhere in module so In addition to would and it creates a clustering for you so that's clustering is NP hard so you will not get always the same result and it may be quite calculation need some time to come out later but for the size it's still a great so you mean much because sizes will work so I get a petition and now again I split up petition to get all the nodes communities here in the 1st you have again don't need them we the communities and now I can again some attributes for a new column to our common data source community and now I have communities in large datasets now I mean I just took coloring mapping because I want different colors as a list of list of colors and using what during the moriori modeling operator to just give every cubic color and now I can the amount of and this is something so you just he added new column but you're not using the problem is the renderer instead we have a class like
this on Hastelloy fixed size and it's the color so I just change them in my column data sources and the same now centrality and now use community color for the column and now concluded and now you can see different colors different sizes and as they start in the middle so it's your points so yes and in there because I want to show you now I want to interactively remove
because I don't want to have a social network of people plotting tutoring about your prices and if there's surprised and it's not doesn't match my makes much sense so we have to change it and you want to do it interactively so I want to see I want to click on a node here uh there's a little market because
it's a slideshow and usually it's also more books and you can't go about I can show it here you can go here Clinton something markets and then you can can you I want to that because say pockets of that dataset I want to remove it and I want to do some recalculation so what I can do
I can do do interactions and I can get out of common data source which small selected atom but to select the
data structure and here so you have 1 0 do 1 D and 2 and is just for a lines and patch all other trees like circles and the 1 of the uh um he went to Dr might symbology line drawings like talk something like this so we just go there used the 1 D key and we have the indices of all marked notes currently in all plots and what we can do now we can remove it and this is just an example code it can do better sink and so I get the index and that to get the note from a network and now we can remove that 1 can remove the North from a network of people public of Malay layout but I have to reconquer literary structure my data in my commentator system cause currently they're not sharing and the data and so I iterate over all of the roles that all over all columns and I remove the index so you could also remove multiple them and again then you update the data at just a new data for the for every column and you the dictionary for the updated edges and then you can move match can remove a note well there's a problem what is right but it still has some problems not everything is working on mobile and and so not book justice larger but it's a you cannot data sources or redraw automatically for change it and common data so you can push Europe um changes there we can create a portion of the redrawing or if you run it in the
book automatically redraws because usually it will determine and you always and check for changes on Market Street and change and another problem is you cannot get those values so what I showed you here this not working currently in the list of all
people will always be empty so you have to do this in book is 7 OK this is still great I can use a book so from my at and it's not much a problem so you can another project I say yes you if you want to add adjust to you but not for Canon and which is like slightest patterns of like this label run this tells cold but you can translate it what you drop it in the notebook there's still status cuprizone function cuprizone called the quantum but now I want to show you that you can do with those interactions so as I said this is the Europe lies in the work on of twitter and I want to remove it so I marketed I can remove it and see you know it's gone and we have this some other connections we see some strong alliance also connection between all those you have my pitch would have more about each other's than others and I can switch so you see the problem but still there's no no central person because you removed conversant person or a fast I still have drafted
properties as push a button cultural and call the update function I go back to my network just some calculations would get information would my column data source and I see now more interesting people might be of interest to you because they are to during a lot here I think it's the obvious technical and they are connected to other people's and yes but we still have the old labeled so we
can update the layout it takes a while and now we get this layer let's look at the at the moment of course for now the network of your prices will be the last save you have a lot of people who just treated about each other and then you get so one-to-one connections and you also have still like you know what they don't have any connections because you need a review replies but did not remove nodes who have a norm of a note attached began fix so we can remove it now so you see this is 1 of the cells was gone and I can research assumed back and back here and I can update the layout again and I can explore so we can take a look at the brain there so in looking at here is my college is sitting there and I think
that the 2 the most of of the people are of our colleagues and consume in in Europe and see rare birds which people use to you also use another and goes but
I cannot nodes across what happens if you get a meltdown and decides to go to to travel assignment 2nd again and then I can again updated probabilities and stuff like that so the same I did mostly interactive network plotted in just a few minutes and I think it's so quite handy if you just want to explore you can go further and do some more stuff
and of course you can just switch network it's it's a great library was constructed for other observations maybe you want to use that number while stuff like this you want to do some uh he development and you want applauded just think about it you can do it you can and that's not so not so complicated to bring it to OK and interactively change maybe what you're doing and bring in some values you want to change and I think that's it I hope you have enjoyed and maybe learn
something if you want to get the documents and the notebook with the each metadata and how it can get the data and you can go to all company grew from the documents their presentations for this year last year you balloons for what it's the bookie bet that few
the and this is working with all the layouts which are possible in the network gets me OK or not can you customize the layout more like it like 5 with 10 different network layouts and because they that process some may also referendum circular but they're not so sophisticated it if anyone I have like a specialized on my own staff can I use these says well say the word or you can be tried in northern try but if you can generate and that just generate positions should not be a problem so if you want to for example if you want to to have a spring layout very apparent move clusters near together you can just you have to copy it you have to forfeit maybe that would it's and then you can bring in some additional forces to all of each of the more there should not be such a problem takes like in pipeline right so you 1st of of the nodes and the edges and then I can put it into this kind of things with to understand better the connection between the book and that protects the once you've done the initial graph with book when you do some more things in life go back network again the a when you do things at this point yeah I go back to where it's of OK the ago I want to see a different centrality you're closeness centrality goes back to that but it's a calculated that not pre-calculated just for the functions they go go back to that but it's called algorithms so move on that but it's a old and then you have to transform it back and then you can use thanks be so I think talk they but as I said it is from a book of you did yourself that this is something and yeah know sort of the slide so that's basic patterns from booking to answer say I want to have a button on there and then you add up function to about you bring order and case realize that to provide maybe another and then you have those problems and they do something what you numerous times no demanding and flowers
Slide rule
Computer program
Code
View (database)
Web browser
Client (computing)
Mereology
Twitter
Internetworking
Natural number
Database
Area
Graph (mathematics)
Red Hat
Moment (mathematics)
Projective plane
Sampling (statistics)
Local Group
Data mining
Category of being
Word
Computer animation
Visualization (computer graphics)
Vector space
Software
Computer network
Module (mathematics)
Library (computing)
Web page
Observational study
Scientific modelling
Source code
Distance
Number
Twitter
Mathematics
Bit rate
Computer network
Graph drawing
Friction
Units of measurement
Position operator
Social class
Task (computing)
Form (programming)
Graph (mathematics)
Information
Computer
Forcing (mathematics)
Moment (mathematics)
Sound effect
Coordinate system
Bit
Table (information)
Spring (hydrology)
Computer animation
Visualization (computer graphics)
Personal digital assistant
Data storage device
Computer network
Vertex (graph theory)
Iteration
Communications protocol
Row (database)
Point (geometry)
Graph (mathematics)
Information
Moment (mathematics)
Ext functor
Bit
Data dictionary
Weight
Frame problem
Computer animation
Vertex (graph theory)
n-Tupel
Mathematical optimization
Area
Subject indexing
Category of being
Pointer (computer programming)
MUD
Computer animation
Right angle
Plot (narrative)
Maxima and minima
Point (geometry)
Service (economics)
State of matter
Mountain pass
Source code
Gene cluster
Weight
Data dictionary
Maxima and minima
Computer network
Circle
Subtraction
Position operator
Metropolitan area network
Fingerprint
Metropolitan area network
Algorithm
Information
Cellular automaton
Open source
Electronic mailing list
Bit
Line (geometry)
Plot (narrative)
Maxima and minima
Category of being
Word
Uniform resource locator
Computer animation
Graph coloring
Royal Navy
Computer network
Volumenvisualisierung
Vertex (graph theory)
Website
Heuristic
Matching (graph theory)
Point (geometry)
Email
Multiplication
Spacetime
Mountain pass
Range (statistics)
Source code
Bit
Dressing (medical)
Maxima and minima
Centralizer and normalizer
Computer animation
Computer network
Vertex (graph theory)
Units of measurement
Information security
Chi-squared distribution
Point (geometry)
Addition
Mapping
Line (geometry)
Scientific modelling
Multiplication sign
Source code
Gene cluster
Electronic mailing list
Attribute grammar
Calculation
Centralizer and normalizer
Computer animation
Graph coloring
Operator (mathematics)
Volumenvisualisierung
Module (mathematics)
Vertex (graph theory)
Whiteboard
Subtraction
Resultant
Computer animation
Vertex (graph theory)
Matching (graph theory)
Code
Line (geometry)
Patch (Unix)
Source code
MIDI
Bit
Mathematics
Causality
Circle
Vertex (graph theory)
Data structure
Physical system
Key (cryptography)
Patch (Unix)
View (database)
Server (computing)
Interactive television
Price index
Line (geometry)
Plot (narrative)
Maxima and minima
Subject indexing
Computer animation
Network topology
Intrusion detection system
Computer network
Matching (graph theory)
Laptop
Laptop
Server (computing)
Projective plane
Electronic mailing list
Interactive television
Functional (mathematics)
Connected space
Twitter
Maxima and minima
Mathematics
Computer animation
Quantum
Laptop
Category of being
Calculation
Computer animation
Information
Cellular automaton
Source code
Computer network
Moment (mathematics)
Vertex (graph theory)
Normal (geometry)
Functional (mathematics)
Connected space
Electronic data interchange
Computer animation
Computer network
Vertex (graph theory)
Laptop
State observer
Computer animation
Presentation of a group
Computer network
Software developer
Computer network
Metadata
Number
Library (computing)
Point (geometry)
Slide rule
Multiplication sign
Gene cluster
Centralizer and normalizer
Video game
Subtraction
Position operator
Algorithm
Graph (mathematics)
Process (computing)
Closed set
Forcing (mathematics)
Staff (military)
Functional (mathematics)
Connected space
Word
Spring (hydrology)
Computer animation
Personal digital assistant
Computer network
Order (biology)
Vertex (graph theory)
Pattern language
Right angle
Quicksort
Loading...
Feedback

Timings

  416 ms - page object

Version

AV-Portal 3.8.0 (dec2fe8b0ce2e718d55d6f23ab68f0b2424a1f3f)