Visualize your NodeXL data in Graphistry using Python

Dr. Veronica Espinoza
4 min readMar 16, 2023

--

By Dr. Verónica Espinoza, 2023 / ✔Twitter @Verukita1 ✔LinkedIn Dra. Verónica Espinoza

Image by the author

¿What is Graphistry?

Graphistry brings visual graph intelligence to your big or complex data. It automatically transforms your data into interactive, visual maps built for the needs of analysts. Quickly surface relationships between events and entities with less time writing queries or wrangling data. As the first automatically GPU-accelerated platform, harness all your data without worrying about scale, and pivot on the fly to follow anywhere your investigation leads you. Ideal for everything from security, fraud, and IT investigations to 360° views of customers and supply chains to mapping cancer mutations, Graphistry turns the potential of your data into human insight and value [1].

¿What is NodeXL?

The Social Media Research Foundation is the home of the network analysis tool NodeXL — Network Overview Discovery and Exploration for Excel (2010, 2013 and 2016) — extending the familiar spreadsheet so you can collect, analyze and visualize complex social networks from Twitter, YouTube, Wikipedia and Flickr. NodeXL adds menus and features to Excel to simplify the tasks of getting network data, storing it, analyzing and visualizing it, and generating reports that share insights into connected structures[2].

What will we review in this tutorial?

In this tutorial we will review how to connect a NodeXL Workbook (Twitter) to the Graphistry tool. We will take the NodeXL Workbook from the NodeXL Gallery to connect it with Graphistry and visualize the network in this tool.
For this, we will use Python code [3].

🏁Let’s start!

Steps to explore your NodeXL data in Graphistry using Python

Installs, imports, & creds

Note: you may need to restart the kernel to use updated packages.

pip install -q --user graphistry pandas
# Sometimes also need to install a new system Excel parser and pass in as `graphistry.nodexl(..., engine='openpyxl')
!pip install openpyxl

Imports & credentials

Import the corresponding libraries with the following code:

import pandas as pd
import graphistry
graphistry.__version__

Now, in the following code type your username and your password of Graphistry account. Get here your Graphistry account, It´s very easy!

# To specify Graphistry account & server, use:
graphistry.register(api=3, username='YOUR USER NAME', password='GRAPHISTRY PASSWORD', protocol='https', server='hub.graphistry.com')

Connect your NodeXL Workbook with Graphistry

To get the URL of the NodeXL Workbook that you want to display in Graphistry, go to the NodeXL Gallery, select the network you want to work with, find the corresponding NodeXL Workbook and place your mouse over this file, now click the right mouse button and copy the URL to the clipboard.

Figure 1. The image shows the location of the workbook from which the corresponding URL is obtained.

Now, paste this URL into this code, as shown:

#g = NodeXLGraphistry().xls(xls, 'twitter')
g = graphistry.nodexl('http://nodexlgraphgallery.org/Pages/Workbook.ashx?graphID=285611')

Visualize information of your Workbook with the following code:

print('%s nodes, %s edges' % (len(g._nodes), len(g._edges)))
g._nodes.sample(2)
Figure 2. Code that displays the information from the NodeXL Workbook.

Finally, visualize the graph in Graphistry tool with the following code:

g.plot()
Figure 3. Visualization of NodeXL data in Graphistry.

Now, open the generated graph in a new window to explore it more easily by clicking WORKBOOK, as shown.

Figure 4. WORKBOOK: Option to display the graph in full screen.

Now, explore the results, and make any display adjustments you want.

Figure 5. Graphistry in full screen mode.

To summarize the process I describe above, you just need the following code to connect your NodeXL data in Graphistry:

Figure 6. Full code to connect NodeXL data in Graphistry.

Demo:

Figure 7. Demo of the code.

Conclusion

In this tutorial we have reviewed how to visualize NodeXL data (Twitter) in the Graphistry tool using Python. With this code you will be able to connect any NodeXL Gallery URL with Graphistry and visualize your network interactively.

👍Thanks for reading this story

😃My Twitter

🔍Find more stories I’ve written here

Resources

Do you want to know more about NodeXL?

I share with you this story I wrote about NodeXL

🌐NodeXL website

🌐Graphistry website

🌐Graphistry Github

References

[1] Home [Internet]. Graphistry. [cited 2023 Feb 20]. Available from: https://www.graphistry.com/

[2] Social Media Research Foundation [Internet]. Social Media Research Foundation. [cited 2023 Mar 15]. Available from: https://www.smrfoundation.org/.

[3] PyGraphistry: Explore Relationships [Internet]. Graphistry; 2023 [cited 2023 Feb 21]. Available from: https://github.com/graphistry/pygraphistry/blob/c6ece09b8b75fb7c096f6c84bbf7b2d9c7cd566d/demos/demos_databases_apis/nodexl/official/nodexl_graphistry.ipynb

--

--

Dr. Veronica Espinoza

👨‍🎓 PhD Humanities 🧠M. Sc Neurobiology 🧪B.S. Chemistry. 👉 X: @Verukita1 😉 Support my work here: https://acortar.link/1ZonMU 🌐website: www.nethabitus.org