lu.cs.co.graph
Class Book

java.lang.Object
  |
  +--lu.cs.co.graph.Graph
        |
        +--lu.cs.co.graph.Book

public class Book
extends Graph

Constructors for undirected graphs based on a work of literature. The vertices represent characters that appear in well-known novels, or chapters in these novels. Edges join characters to the chapters they appear in, or to other characters encountered in the same chapter.

The graph can be based on one of five classics:

Abbreviation Title Author
anna Anna Karenina Tolstoy
david8 David Copperfield Dickens
homer The Iliad Homer
huck Huckleberry FinnTwain
jean8 Les MisèrablesHugo
Dickens' and Hugo's books contain character names requiring characters outside the ASCII standard, which have been coded in UNICODE. Without the `8' suffix, these names are available in TeX's encoding. For example, Félix Tholomyès, the Parisian student from Toulouse, becomes F\'elix Tholomy\`es.


Fields inherited from class lu.cs.co.graph.Graph
m, n, name
 
Constructor Summary
Book(String ttl)
          All encounters between characters in a given book.
Book(String ttl, int num)
          Encounters between the most common characters in a given book.
Book(String ttl, int num, int skip)
          Encounters between some of the more common characters in a given book.
Book(String ttl, int num, int skip, int first, int last, int in, int out, boolean bip, long sd)
          General character-character or character-chapter relations in a given book.
 
Methods inherited from class lu.cs.co.graph.Graph
degree, edges, findByName, getAdjecencyMatrix, getDistanceMatrix, getEdge, getIndex, getVertex, getVertex, hasEdge, incident, incoming, indegree, index, isDirected, main, outdegree, outgoing, parseGraph, toString, vertices
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Book

public Book(String ttl)
All encounters between characters in a given book.
Parameters:
ttl - abbreviated title of the given book, for example "anna" or "huck"

Book

public Book(String ttl,
            int num)
Encounters between the most common characters in a given book.
Parameters:
ttl - abbreviated title of the given book, for example "anna" or "huck"
num - number of characters to be included. If this value is zero or exceeds the number of characters appearing in the book, the maximal value is substituted

Book

public Book(String ttl,
            int num,
            int skip)
Encounters between some of the more common characters in a given book. A given number of the most common characters is skipped. This is useful for books narrated in the first person (like Huckleberry Finn), since one character is incident to almost everybody else.
Parameters:
ttl - abbreviated title of the given book, for example "anna" or "huck"
num - number of characters to be included. If this value is zero or exceeds the number of characters appearing in the book, the maximal value is substituted
skip - the number of characters to be skipped

Book

public Book(String ttl,
            int num,
            int skip,
            int first,
            int last,
            int in,
            int out,
            boolean bip,
            long sd)
General character-character or character-chapter relations in a given book.

A range of chapters in the book can be selected by specifying the last and first chapters to be included.

Characters are selected for inclusion based on the value

in * numChapsIn + out * numChapsOut
where numChapsIn is the number of chapters (in the selected range) in which the character appears, and numChapsOut is the number of appearances in other chapters. In and out are two given paramters of absolute value at most 1000000. For example,
Book("anna", 10,0,0,0,1,1,false,0)
selects the 10 most common characters in Anna Karenina
Book("anna", 10,0,0,0,0,0,false,0)
selects 10 characters at random

Finally, a bipartite graph can be constructed between characters and the chapters in which they appear.

Parameters:
ttl - abbreviated title of the given book, for example "anna" or "huck"
num - number of characters to be included. If this value is zero or exceeds the number of characters appearing in the book, the maximal value is substituted
skip - the number of characters to be skipped
first - the first chapter to be included
last - the last chapter to be included
in - the in-weight (see above)
out - the out-weight (see above)
bip - if true, constructs a bipartite character-chapter graph
seed - the seed used in all random choices