Roland KesziArtificial Intelligence &
Data Science Portfolio

On these pages I share the results of some of my data science and artificial intelligence based analysis projects.

Pages for higher education ↗

← All projects

Network structures in research literature, social media and text

Network science applied to three kinds of human-generated data, as groundwork for sentiment analysis research: a map of the research field, the structure of a real social network, and topical clusters in social media messages.

Data
OpenAlex publications, SNAP ego-Facebook (4,039 users), political tweets (aggregated)
Methods
Co-occurrence maps, degree distribution, hubs, community detection, TF-IDF similarity
Tools
Python (NetworkX, spaCy), Gephi, VOSviewer

Why networks?

Text written by people has no structure of its own. Network tools are one way to find order in it: in how publications on a topic relate to each other, in how people connect, and in how their messages resemble each other. This study tested several such tools side by side before a larger sentiment analysis project.

1. Mapping the sentiment analysis literature

I pulled bibliographic data on 2024 publications from the OpenAlex API, mapped the terms that co-occur in abstracts with VOSviewer, and measured the network in Gephi.

VOSviewer keyword map of the sentiment analysis literature
Co-occurrence map of research fields in 2024 sentiment analysis publications. The network has 286 nodes and 8,633 edges, a density of 0.21 and three communities (modularity 0.23).

Three fields form dense clusters. Psychology and social psychology provide the theoretical grounding. Political science takes part through elections and civic behaviour. Computer science contributes the methods, and NLP sits between them. The degree distribution is scale-free: a few highly connected publications and many weakly connected ones.

A practical lesson was that the search term matters. Searching for social sentiment returned mostly COVID-19 papers, which made sentiment analysis the more relevant query.

2. Hubs and scale-free structure in a Facebook network

The SNAP ego-Facebook network contains 4,039 anonymised users and 88,234 friendships. The average user has 44 friends, and any two users are on average only 3.7 steps apart.

Facebook friendship network with the three largest hubs highlighted
The network breaks into distinct friendship circles. The three largest hubs (nodes 107, 1684 and 1912, in red) connect hundreds of users each.

Is the network random or scale-free? The answer is in the tail of the degree distribution. A random network with the same average degree would produce a narrow Poisson peak. This network instead has a long, heavy tail: most users have few friends, and a few hubs have hundreds.

Degree distribution on linear and log-log scales compared with Poisson
On the log–log plot the observed degrees (blue) spread over three orders of magnitude, far from the Poisson curve (red). This is the signature of a scale-free network.

This confirms that the network follows a power-law degree distribution and is not randomly organised, as Barabási (2016) describes for real social networks.

3. A similarity network of social media messages

I processed a public set of political tweets with spaCy, measured the similarity between them with TF-IDF, and connected similar messages with NetworkX using a force-directed layout.

Similar tweets formed small topical clusters, for example on workplace harassment, housing policy, immigration and agriculture. Combining NLP with network methods made the topical structure of the corpus visible. This is a useful step before sentiment analysis.

A negative result worth keeping. The same TF-IDF approach on a small pilot survey of 207 students' open-ended answers gave no meaningful structure: the network of the 50 most frequent words was almost complete. That finding shaped the design of later, larger studies. The raw survey data are not published.

Conclusions

Network tools give a fast, bird's-eye view of a research field and help focus the literature search. The Facebook network is scale-free and dominated by a few hubs, the hallmark of non-random social networks. Text similarity networks reveal topical clusters in social media. The study also showed which tools work for which task: Python (NetworkX, spaCy), Gephi and VOSviewer.

→ Code and executed notebook on GitHub

Data: OpenAlex; SNAP ego-Facebook (McAuley & Leskovec, 2012). Reference: Barabási, A.-L. (2016). Network Science. Cambridge University Press.