Contents
Contents
Tap any chapter to start reading.
Chapter 1 Basics of NetworksNodes, edges, adjacency matrices, paths, components. Construct and visualise graphs with NetworkX; compute degree, betweenness, closeness, and eigenvector centrality on real networks (Facebook ego graph, terrorist networks, trading networks).
Chapter 2 Identifying Important NodesPageRank as a random walk; influence maximization (greedy + submodularity); independent cascade and linear threshold models; strategic leaders in coordination games.
Chapter 3 Community DetectionModularity, Girvan–Newman edge betweenness, Louvain, Infomap. Choosing the right algorithm; evaluating partitions; interpreting communities in social, financial, and citation networks.
Chapter 4 Formation of NetworksErdős–Rényi random graphs, Watts–Strogatz small-world, Barabási–Albert preferential attachment. Why real networks are scale-free; diffusion of innovations on each model.
Chapter 5 Attention, Learning, and Games on NetworksBayesian and naïve social learning; DeGroot opinion dynamics; coordination, anti-coordination, and best-response games on networks; herding and information cascades.
Chapter 6 Topic ModelsFrom bag-of-words to LDA: discovering latent themes in corpora of tweets, earnings calls, and news headlines. Coherence, perplexity, choosing K, and reading topics as financial-market signals.
Chapter 7 Sentiment AnalysisLexicon-based scoring (Loughran–McDonald, VADER), supervised classifiers, and transformer-based sentiment (FinBERT, RoBERTa). Building sentiment indices from Twitter and earnings calls.
Chapter 8 Information Cascades and ViralityRetweet trees, structural virality (Goel et al. Wiener index), Independent Cascade and Linear Threshold models, empirical power laws in cascade size, influencer detection beyond degree, SIR temporal dynamics.
How to read this book
Every Python code block in this book runs live in your browser. Click into any cell, edit it, press the ▶ Run button, and see the output. The Python engine downloads once on the first chapter — after that, everything is instant.
- The book has two halves. Chapters 1–5 build the language of networks; Chapters 6–8 build the language of text and cascades. They are independent and can be read in either order.
- Edit the code cells. Vary the seed, the network size, the parameters — that is how the intuition lands.
- Once you’ve absorbed the foundations here, the companion volume Modern AI Stack for Social Data picks up where this one ends.