Skip to main content

GraphTopic

Graph-based topic modeling built on semantic graphs.

GraphTopic is a Python library for discovering document topics using graph-based community detection instead of traditional clustering algorithms.

It is built on top of Graphion, a modular graph processing framework, allowing every stage of the topic modeling pipeline to be customized.


Features

  • Graph-based topic discovery
  • Pluggable embedding models
  • Pluggable graph construction
  • Pluggable community detection
  • Pluggable topic representation
  • Simple sklearn-like API
  • Built on Graphion

Installation

Install the core library:

pip install graphtopic

To use the built-in SentenceTransformer embedding model:

pip install "graphtopic[embedding]"

Quick Start

from graphtopic import GraphTopic
from graphtopic.embedding_models import (
    SentenceTransformerEmbedding,
)

documents = [
    "Apple released a new iPhone.",
    "Samsung announced a new Galaxy phone.",
    "Barcelona won the football match.",
    "Real Madrid signed a new player.",
]

model = GraphTopic(
    embedding_model=SentenceTransformerEmbedding(
        "sentence-transformers/all-MiniLM-L6-v2"
    )
)

topics = model.fit_transform(documents)

for topic in model.get_topic_info():
    print(topic)

Pipeline

GraphTopic follows a modular processing pipeline:


Documents
↓
Embeddings
↓
FeatureSet
↓
Relation Graph
↓
Community Detection
↓
Topic Representation
↓
Topic Information

Each stage can be replaced with custom implementations.


Custom Components

GraphTopic is designed around interchangeable components.

You can replace:

  • Embedding Model
  • Reducer
  • Relation Builder
  • Graph Builder
  • Graph Refiner
  • Community Detector
  • Partition Refiner
  • Representation Model

This makes it easy to experiment with different graph construction and topic discovery strategies.


Built on Graphion

GraphTopic uses Graphion as its graph processing backend.

Graphion provides reusable components for:

  • similarity computation
  • graph construction
  • graph refinement
  • community detection
  • graph processing pipelines

GraphTopic focuses only on topic modeling while delegating graph operations to Graphion.


Requirements

  • Python 3.11+
  • NumPy
  • scikit-learn
  • Graphion

Project Status

GraphTopic is currently in Pre-Alpha (0.0.x).

The public API is expected to evolve as new functionality is added.


License

MIT License

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graphtopic-0.0.1.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graphtopic-0.0.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file graphtopic-0.0.1.tar.gz.

File metadata

  • Download URL: graphtopic-0.0.1.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for graphtopic-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b51befa8a3a0cd43bf321e796a156d01c320ff49760b01e04f11312c160f54c4
MD5 7da70f439b80cb615c62e303ff815d98
BLAKE2b-256 289d392995ee4da9f81627834ce813f50404f5f373db94b46dc0bab7b901a444

See more details on using hashes here.

File details

Details for the file graphtopic-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: graphtopic-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for graphtopic-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d78cca6e3398d91a3b4d4cd538f6126b5f9200c393b4bf1e407527d2290faee0
MD5 c9f2a274252abe7a2ce66706e4cc66ff
BLAKE2b-256 fcae8e4e90853a3115d29f82a3975c3a5524c2cd86d9a10510f9a80c30d1b26c

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.2

2 files

This release

0.0.1 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page