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 and a manuscript.
data- data gathered for the project;sgb- some data from Stanford GraphBase.
- Python and the packages:
- matplotlib;
- NetworkX;
- PyGraphviz;
- plfit - this package is automatically installed after running
make. It is used to fit data to power law distribution.
The structure of the project 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 Leafs.
-
Book: methods declared here are inherited byLeafbooks, and the main method isread()that returns aGraphcontaining characters' encounters as edges. -
Acts: is an example of concreteLeafclasses, likeActsthat represents the book "acts of apostles", were coded inside inside the filebooks.py. -
Books: is theCompositeclass,read()method has a different behavior iterating over allLeafs 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 an instance fromGraphfrom NetworkX 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.
To generate all results and plots, just run:
$ make
To select a specific target, see the help:
$ make help
To clean the output generated:
$ make clean
Please, open an issue for any feeback.
