项目作者: ajholanda

项目描述 :
Character networks.
高级语言: Python
项目地址: git://github.com/ajholanda/charnet.git
创建时间: 2017-03-23T14:25:17Z
项目社区:https://github.com/ajholanda/charnet

开源协议:GNU General Public License v2.0

下载


charnet - 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.

Directories content

Prerequisites

  • Gnuplot: mixed with jinja2 template engine
    to produce graphics with excellent quality;
  • Python and the packages:
    • jinja2 - template engine used to handle view tangled with logic;
    • graph-tool - used to calculate the network measures and draw the graphs;
    • numpy and scipy.

Structure

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 Leafs.

UML class diagram

  • 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, like
    Acts 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 Leafs to execute their
    read() 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.

Running

Install graph-tool according to your setup by following the
installation instructions.

Download the charnet using git and enter in the charnet directory:

  1. $ git clone https://github.com/ajholanda/charnet.git && cd charnet

To install the dependencies, the easy way is to run

  1. $ python3 setup.py install --user

Install graph-tools and run all the project tasks:

  1. $ python3 charnet -a

To print the possible tasks to be performed apart:

  1. $ python3 charnet -h

To clean the generated files:

  1. $ python setup.py clean --all

Feedback

Please, open an issue for any feeback.