4.2.1 Graph Objects

Pedigrees can be represented as a type of mathematical object called a directed graph (digraph; not to be confused with visualizations of data). The NetworkX module provides Python tools for working with digraphs, and PyPedal provides a convenient way for loading a pedigree from an instance of an XDiGraph object.
example = pyp_newclasses.loadPedigree(optionsfile='new_networkx.ini')
ng = pyp_network.ped_to_graph(example)
options = {}
options['pedfile'] = 'dummy'
options['pedformat'] = 'asd'
example2 = pyp_newclasses.loadPedigree(options,pedsource='graph',pedgraph=ng)
example2.metadata.printme()
You can see from the printout of the metadata from the new pedigree, "example2", that the graph "ng" was successfully converted to a NewPedigree object.
Metadata for  Testing fromgraph() (dummy)
Records:                13
Unique Sires:           3
Unique Dams:            4
Unique Gens:            1
Unique Years:           1
Unique Founders:        5
Unique Herds:           1
Pedigree Code:          asd
When considering the utility of such tools it might be helpful to recall that PyPedal was written by and for use in scientific research. Perhaps that will allow the author to be forgiven a multitude of sins.

See About this document... for information on suggesting changes.