Skip to content

h1-the-swan/pajek_tools

Repository files navigation

Pajek Tools

Tools for converting network data to pajek files.

Pajek is a file format for networks, typically stored in files with a .net extension. It is used as input for software such as Infomap.

Installation

Install from PyPI:

pip install pajek-tools

Usage

Use the PajekWriter object to convert a network from an edgelist in pandas DataFrame form, to a Pajek .net file:

from pajek_tools import PajekWriter
writer = PajekWriter(dataframe)
writer.write("output.net")

Example

from pajek_tools import PajekWriter
import pandas as pd

df = pd.DataFrame([["a", "b"], ["a", "c"], ["c", "a"], ["c", "d"]], columns=["source", "target"])
writer = PajekWriter(df,
                     directed=True,
                     citing_colname="source",
                     cited_colname="target")
writer.write("output.net")

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

About

Tools for converting network data to pajek files

Resources

License

Stars

Watchers

Forks

Packages

No packages published