fmgraph - Trace bloodline relations

25 Apr 2001

This has been a write-only affair. I am sure I will not be touching/debugging this program later. Here are some guidelines.

The family file

This is a simple text file containing the names of people. Each non-comment line should contain a valid nuclear family. A valid nuclear family line is of the form:
father:mother:child1:child2:child3

The separator is ":". Names can have any character except "\n" and ":". Names which are not known can be written as a "?". All lines starting with a space or a "#" are treated as comments. Empty lines are also ignored.
Two sample files are provided (dynasty and myfamily). dynasty contains a very simple family, which demonstrates most of these points. myfamily is a pretty decently sized family. This is where the program can really help. Getting the connection betweeen two very distantly related people is fun!
Note that there cannot be two people with the same name in a family file. You should differentiate them using, say, the abbreivated surname. The results are undefined if you use identical names to represent two different people.

Get going

You need to "make" in the directory where you have extracted the source files. You should get an executable called "fmtest". Run it with the sample file, dynasty. It asks for two names. Start with something like "Rajiv" and "Indira". The program responds with "Indira is the mother of Rajiv". Next try something like "Priyanka" and "J Nehru". OK!

Now try "Sonia" and "Indira". This results in:

Priyanka is a child of Sonia
Rajiv is the father of Priyanka
Indira is the mother of Rajiv

What is Priyanka doing in a connection between Sonia and Indira? The answer is that the program finds relations thru "blood lines". There is no blood relationship betweeen Rajiv and Sonia. Therefore it doesn't take the shortcut which would have looked like:

Rajiv is the husband of Sonia
Indira is the mother of Rajiv

Note that this means all "connections" found will be a set of parent-child relationships.

Some limitations

There are some #defines hard coded in fmgraph.h which you should know about: MAXNODES (the max number of people possible in the graph), MAXCHILDREN (the max number of children in a nuclear family).
Apart from these, there are others: MAXLEN (the max length in characters of a nuclear family line in a family file), MAXNAME (the max character length of any name)
These four #defines can be modified as required. A make will, of course, be necessary after this.
The program has not been tested and may dump core at exceptional inputs.

Functions of interest

void BuildGraph(char* filename)

The following 3 functions return the connection "line".
int* GetMAncestors(char* name) - Ancestry along female line
int* GetPAncestors(char* name) - Ancestry along male line
int* FindConnection2(char* name1, char* name2) - Generic connection between any two people

void PrintLine(int* line)
void PrintLineWithRelations(int* line)

Back to personal home