Character networks.
This project performed studies using complex networks in some books. We considered
characters as nodes and characters encounters as edges. The project
has a GitHub page, a
manuscript and a
presentation.
_assets
- files used to document or manage the project;charnet
- Python code for the project;data
- data gathered for the project;sgb-data
- some data from Stanford GraphBase.numpy
and scipy
.The structure of the project in charnet/
follows,
mainly, the Composite design pattern where Book
is the Component
,Books
class is the Composite
, and the books like “acts of the
apostles” (Acts
) and the biography of J. R. R. Tolkien (Tolkien
)
are Leaf
s.
Book
: methods declared here are inherited by Leaf
books, and the main method is read()
that returns a Graph
containing characters’ encounters as edges.
Acts
: is an example of concrete Leaf
classes, likeActs
that represents the book “acts of apostles”, were coded
inside inside the file books.py
.
Books
: is the Composite
class, read()
method has a
different behavior iterating over all Leaf
s to execute theirread()
method.
Formatting
: is responsible to write
LaTeX-formatted output to append in the paper.
Graphs
: process graphs to obtain measures used in the
analisys like average degree, betweenness, closeness and lobby.
Graph
: is a Graph
instance from graph-tool library.
Plot
: plot the curves from data generated from
graphs.
Draw
: draw graphs using graphviz python library.
lobby()
: function to calculate the lobby index.
Charnet
: helper to handle configuration specific to
books gathered in this project.
SGB
: helper to handle configuration specific to books
gathered in Stanford GraphBase project.
Project
: template (interface) for project properties.
main
: client to execute the operations.
Install graph-tool
according to your setup by following the
installation instructions.
Download the charnet using git
and enter in the charnet
directory:
$ git clone https://github.com/ajholanda/charnet.git && cd charnet
To install the dependencies, the easy way is to run
$ python3 setup.py install --user
Install graph-tools and run all the project tasks:
$ python3 charnet -a
To print the possible tasks to be performed apart:
$ python3 charnet -h
To clean the generated files:
$ python setup.py clean --all
Please, open an issue for any feeback.