pgncc = networkx.number_connected_components(pgu) print 'number_connected_components: %s' % (pgncc) ped_deg = pyp_network.get_node_degrees(pg) ped_hist = pyp_network.get_node_degree_histograms(ped_deg) print 'ped_hist:\t' for k, v in ped_hist.iteritems(): print '\t\t', k, '\t', v print 'nodes:\t\t', pg.order() print 'edges:\t\t', pg.size() density = pyp_network.graph_density(pg) print 'density:\t', density census = pyp_network.dyad_census(pg) print 'max dyads:\t', ((pg.order() * (pg.order() - 1)) / 2) print 'census:\t\t', census geodesic = pyp_network.mean_geodesic(pg) print 'geodesic:\t', geodesic centrality = pyp_network.mean_degree_centrality(pg) print 'centrality:\t', centrality centrality = pyp_network.mean_degree_centrality(pg, normalize=1) print 'normed central:\t', centrality close = pyp_network.get_closeness_centrality(pg) mean_close = pyp_network.mean_value(close) print 'mean closeness:\t', mean_close
pgncc = networkx.number_connected_components(pgu) print 'number_connected_components: %s' % ( pgncc ) ped_deg = pyp_network.get_node_degrees(pg) ped_hist = pyp_network.get_node_degree_histograms(ped_deg) print 'ped_hist:\t' for k,v in ped_hist.iteritems(): print '\t\t', k, '\t', v print 'nodes:\t\t', pg.order() print 'edges:\t\t', pg.size() density = pyp_network.graph_density(pg) print 'density:\t', density census = pyp_network.dyad_census(pg) print 'max dyads:\t', ( ( pg.order()*(pg.order()-1) ) / 2 ) print 'census:\t\t', census geodesic = pyp_network.mean_geodesic(pg) print 'geodesic:\t', geodesic centrality = pyp_network.mean_degree_centrality(pg) print 'centrality:\t', centrality centrality = pyp_network.mean_degree_centrality(pg,normalize=1) print 'normed central:\t', centrality close = pyp_network.get_closeness_centrality(pg) mean_close = pyp_network.mean_value(close) print 'mean closeness:\t', mean_close
#coi_by_year #print ib #for _e in example.pedigree: #print _e.name, _e.fa print example.kw['paper_size'] #print example.backmap ## Use with new_renumbering.ped. #pyp_reports.pdf3GenPed([56,72], example) ## Use with horse.ped. #pyp_reports.pdf3GenPed(["Pie's Joseph","Green's Dingo"], example) #pyp_reports.pdf3GenPed("Green's Dingo", example,reportfile='greens_dingo_pedigree.pdf') #pyp_reports.pdf3GenPed(example.namemap.keys(), example) pyp_graphics.draw_pedigree(example, gfilename='greens_dingo_pedigree', \ gtitle="Green's Dingo pedigree", gname=1, gformat='ps', garrow=1) #matings = {} #for s in example.metadata.unique_sire_list: # for d in example.metadata.unique_dam_list: # matings[example.pedigree[s-1].name] = example.pedigree[d-1].name #pyp_metrics.mating_coi_group(matings,example,names=1) pg = pyp_network.ped_to_graph(example) #print pg, pg.degree(), pg.nodes() census = pyp_network.dyad_census(pg, debug=1) print 'max dyads:\t', ((pg.order() * (pg.order() - 1)) / 2) print 'census:\t\t', census
#coi_by_year #print ib #for _e in example.pedigree: #print _e.name, _e.fa print example.kw['paper_size'] #print example.backmap ## Use with new_renumbering.ped. #pyp_reports.pdf3GenPed([56,72], example) ## Use with horse.ped. #pyp_reports.pdf3GenPed(["Pie's Joseph","Green's Dingo"], example) #pyp_reports.pdf3GenPed("Green's Dingo", example,reportfile='greens_dingo_pedigree.pdf') #pyp_reports.pdf3GenPed(example.namemap.keys(), example) pyp_graphics.draw_pedigree(example, gfilename='greens_dingo_pedigree', \ gtitle="Green's Dingo pedigree", gname=1, gformat='ps', garrow=1) #matings = {} #for s in example.metadata.unique_sire_list: # for d in example.metadata.unique_dam_list: # matings[example.pedigree[s-1].name] = example.pedigree[d-1].name #pyp_metrics.mating_coi_group(matings,example,names=1) pg = pyp_network.ped_to_graph(example) #print pg, pg.degree(), pg.nodes() census = pyp_network.dyad_census(pg,debug=1) print 'max dyads:\t', ( ( pg.order()*(pg.order()-1) ) / 2 ) print 'census:\t\t', census