All projects
07Graph theory / NLP2024

Graph-Based Text Classifier

Network analysis of Medium articles via graph theory, spanning trees, and centrality.

Context
Graph Theory course, UET Lahore
Period
2024
Stack
Python · GraphQL · NetworkX · Gravis
Source

How it works

Articles as graphs.

Takes three topics from the user, scrapes 15 Medium articles per topic via GraphQL queries against Medium’s internal API, cleans and tokenizes the content, converts each article into a graph structure, and runs network analysis — then visualizes the result with Gravis.

  • Accept three topics from the user as input.
  • Query Medium’s internal GraphQL API to fetch 15 articles per topic (45 total).
  • Clean and tokenize text, removing stopwords, punctuation, and low-frequency terms.
  • Build a graph per article where nodes are tokens and edges are co-occurrence within a window.
  • Run network analysis: minimum spanning tree, degree centrality, betweenness centrality.
  • Visualize graphs and spanning trees interactively with Gravis.

Engineering detail

Medium does not expose a public API. Reverse-engineering their internal GraphQL schema and constructing valid queries was a core part of the project.