Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Graph Machine Learning

You're reading from   Graph Machine Learning Learn about the latest advancements in graph data to build robust machine learning models

Arrow left icon
Product type Paperback
Published in Jul 2025
Publisher Packt
ISBN-13 9781803248066
Length 434 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Authors (3):
Arrow left icon
Aldo Marzullo Aldo Marzullo
Author Profile Icon Aldo Marzullo
Aldo Marzullo
Enrico Deusebio Enrico Deusebio
Author Profile Icon Enrico Deusebio
Enrico Deusebio
Claudio Stamile Claudio Stamile
Author Profile Icon Claudio Stamile
Claudio Stamile
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Part 1: Introduction to Graph Machine Learning
2. Getting Started with Graphs FREE CHAPTER 3. Graph Machine Learning 4. Neural Networks and Graphs 5. Part 2: Machine Learning on Graphs
6. Unsupervised Graph Learning 7. Supervised Graph Learning 8. Solving Common Graph-Based Machine Learning Problems 9. Part 3: Practical Applications of Graph Machine Learning
10. Social Network Graphs 11. Text Analytics and Natural Language Processing Using Graphs 12. Graph Analysis for Credit Card Transactions 13. Building a Data-Driven Graph-Powered Application 14. Part 4: Advanced topics in Graph Machine Learning
15. Temporal Graph Machine Learning 16. GraphML and LLMs 17. Novel Trends on Graphs 18. Index
19. Other Books You May Enjoy

Analyzing the graph structure

Understanding the topology of the network, the role of its nodes, and the presence of communities is a crucial step in the analysis of the social network. It is important to keep in mind that, in this context, nodes are actually users, each with its own interests, habits, and behaviors. Such knowledge will be extremely useful when performing predictions and/or finding insights.

We will be using networkx to compute a few useful metrics we have seen in Chapter 1, Getting Started with Graphs. We will try to give them an interpretation to collect insight into the graph. Let’s begin as usual, by importing the required libraries and defining some variables that we will use throughout the code:

import os
import math
import numpy as np
import networkx as nx
import matplotlib.pyplot as plt
default_edge_color = 'gray'
default_node_color = '#407cc9'
enhanced_node_color = '#f5b042'
enhanced_edge_color = '#cc2f04&apos...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime