PyPedal::pyp_network Namespace Reference


Functions

def ped_to_graph
def find_ancestors
def find_ancestors_g
def find_descendants
def immediate_family
def count_offspring
def offspring_influence
def most_influential_offspring
def get_founder_descendants
def get_node_degrees
def get_node_degree_histograms
def mean_geodesic
def graph_density
def dyad_census
def mean_degree_centrality
def mean_value
def get_closeness_centrality
def get_clustering_coefficient
def get_betweenness_centrality
def get_node_betweenness


Function Documentation

def PyPedal::pyp_network::count_offspring (   pedgraph,
  anid 
)

count_offspring() returns the number of offspring of an animal.

Parameters:
pedgraph An instance of a networkx DiGraph.
anid The animal for whom offspring are to be counted.
Returns:
Count of offspring. integer
count_offspring() returns the number of offspring of an animal.

Definition at line 181 of file pyp_network.py.

def PyPedal::pyp_network::dyad_census (   pg,
  debug = 0,
  debuglog = 0 
)

dyad_census() calculates the number of null, asymmetric, and mutual edges between all pairs of nodes in a directed graph.

Parameters:
pg An instance of a NetworkX DiGraph.
debug Flag to turn debugging messages on (1) or off (0).
debuglog Flag to turn debugging messages to the logfile on (1) or off (0).
Returns:
A dictionary of counts. dictionary
dyad_census() calculates the number of null, asymmetric, and
mutual edges between all pairs of nodes in a directed graph.

Definition at line 412 of file pyp_network.py.

def PyPedal::pyp_network::find_ancestors (   pedgraph,
  anid,
  _ancestors = [] 
)

find_ancestors() identifies the ancestors of an animal and returns them in a list.

Parameters:
pedgraph An instance of a networkx DiGraph.
anid The animal for whom ancestors are to be found.
_ancestors The list of ancestors already found.
Returns:
List of ancestors of anid. list
find_ancestors() identifies the ancestors of an animal and returns them in a list.

Definition at line 92 of file pyp_network.py.

def PyPedal::pyp_network::find_ancestors_g (   pedgraph,
  anid,
  _ancestors = {},
  gens = 3 
)

find_ancestors_g() identifies the ancestors of an animal going back a user-specified number of generations and returns them in a list.

Parameters:
pedgraph An instance of a networkx DiGraph.
anid The animal for whom ancestors are to be found.
_ancestors The list of ancestors already found.
Returns:
List of ancestors of anid. list
find_ancestors_g() identifies the ancestors of an animal and returns them in a list.

Definition at line 116 of file pyp_network.py.

def PyPedal::pyp_network::find_descendants (   pedgraph,
  anid,
  _descendants = [] 
)

find_descendants() identifies the descendants of an animal and returns them in a list.

Parameters:
pedgraph An instance of a networkx DiGraph.
anid The animal for whom descendants are to be found.
_descendants The list of descendants already found.
Returns:
List of descendants of anid. list
find_descendants() identifies the descendants of an animal and returns them in a list.

Definition at line 144 of file pyp_network.py.

def PyPedal::pyp_network::get_betweenness_centrality (   pg  ) 

get_betweenness_centrality(pg) returns a dictionary of the betweenness centrality of each node in the graph.

Parameters:
pg An instance of a NetworkX DiGraph.
Returns:
A dictionary of closeness centralities. dictionary
get_betweenness_centrality(pg) returns a dictionary of the
betweenness centrality of each node in the graph.

Definition at line 554 of file pyp_network.py.

def PyPedal::pyp_network::get_closeness_centrality (   pg  ) 

get_closeness_centrality(pg) returns a dictionary of the closeness centrality (1/(average distance to all nodes from n)) for each node in the graph.

Parameters:
pg An instance of a NetworkX DiGraph.
Returns:
A dictionary of closeness centralities. dictionary
get_closeness_centrality(pg) returns a dictionary of the close-
ness centrality (1/(average distance to all nodes from n)) for
each node in the graph.

Definition at line 513 of file pyp_network.py.

def PyPedal::pyp_network::get_clustering_coefficient (   pg  ) 

get_clustering_coefficient(pg) returns a dictionary of the clustering coefficient of each node in the graph based on the definition of Watts and Strogatz (1998).

Parameters:
pg An instance of a NetworkX DiGraph.
Returns:
A dictionary of clustering coefficients. dictionary
get_clustering_coefficient(pg) returns a dictionary of the clustering
coefficient of each node in the graph based on the definition of Watts
and Strogatz (1998).

Definition at line 534 of file pyp_network.py.

def PyPedal::pyp_network::get_founder_descendants (   pedgraph  ) 

get_founder_descendants() returns a dictionary containing a list of descendants of each founder in the pedigree.

Parameters:
pedgraph An instance of a NetworkX DiGraph.
Returns:
A dictionary containing a list of descendants for each founder in the graph. dictionary
get_founder_descendants() returns a dictionary containing a list of descendants of
each founder in the pedigree.

Definition at line 270 of file pyp_network.py.

def PyPedal::pyp_network::get_node_betweenness (   pg  ) 

get_node_betweenness(pg) returns a dictionary of the number of shortest paths that go through each node in the graph.

Parameters:
pg An instance of a NetworkX DiGraph.
Returns:
A dictionary of node betweennesses. dictionary
get_node_betweenness(pg) returns a dictionary of the
number of shortest paths that go through each node in
the graph.

Definition at line 573 of file pyp_network.py.

def PyPedal::pyp_network::get_node_degree_histograms (   node_degrees  ) 

get_node_degree_histograms() returns a dictionary containing histograms of the number of vertices (nodes) in pg with a given number of incoming, outgoing, or total edges.

Parameters:
node_degrees A dictionary of dictionaries of in, out, and total node degrees.
Returns:
A dictionary of dictionaries containing in, out, and total degree histograms. dictionary
get_node_degree_histograms() returns a dictionary containing histograms of
the number of vertices (nodes) in pg with a given number of incoming,
outgoing, or total edges.

Definition at line 321 of file pyp_network.py.

def PyPedal::pyp_network::get_node_degrees (   pg  ) 

get_node_degrees() returns a dictionary containing the number of vertices (nodes) in pg with a given number of incoming, outgoing, or total edges.

Parameters:
pg An instance of a NetworkX DiGraph.
Returns:
A dictionary of dictionaries containing in, out, and total node degrees. dictionary
get_node_degrees() returns a dictionary containing the number of
vertices (nodes) in pg with a given number of incoming, outgoing,
or total edges.

Definition at line 295 of file pyp_network.py.

def PyPedal::pyp_network::graph_density (   pg  ) 

graph_density() calculates the density of a digraph, which is the ratio of edges in the gaph to the maximum possible number of edges.

Parameters:
pg An instance of a NetworkX DiGraph.
Returns:
The density of the pedigree represented in pg. float
graph_density() calculates the density of a digraph, which is the
ratio of edges in the gaph to the maximum possible number of edges.

Definition at line 389 of file pyp_network.py.

def PyPedal::pyp_network::immediate_family (   pedgraph,
  anid 
)

immediate_family() returns parents and offspring of an animal.

Parameters:
pedgraph An instance of a networkx DiGraph.
anid The animal for whom immediate family are to be found.
Returns:
List of immediate family members of anid. list
immediate_family() returns parents and offspring of an animal.

Definition at line 165 of file pyp_network.py.

def PyPedal::pyp_network::mean_degree_centrality (   pg,
  normalize = 0 
)

mean_degree_centrality(pg) calculates mean in- and out-degree centralities for directed graphs and simple degree-centralities for undirected graphs. If the normalize flag is set, each node's centralities are weighted by the number of edges in the (di)graph.

Parameters:
pg An instance of a NetworkX DiGraph.
normalize Flag to turn normalization on (1) or off (0).
Returns:
A dictionary of mean degree centralities. dictionary
mean_degree_centrality(pg) calculates mean in- and out-degree
centralities for directed graphs and simple degree-centralities
for undirected graphs. If the normalize flag is set, each node's
centralities are weighted by the number of edges in the (di)graph.

Definition at line 455 of file pyp_network.py.

def PyPedal::pyp_network::mean_geodesic (   pg,
  debug = 0 
)

mean_geodesic() calculates the mean geodesic (shortest) distance between two vertices in a network.

Parameters:
pg An instance of a NetworkX DiGraph.
debug Flag to turn debugging messages on (1) or off (0).
Returns:
The mean geodesic for the pedigree represented in pg. float
mean_geodesic() calculates the mean geodesic (shortest) distance
between two vertices in a network.

Definition at line 355 of file pyp_network.py.

def PyPedal::pyp_network::mean_value (   mydict  ) 

mean_value() calculates the mean from all values in a dictionary.

Parameters:
mydict A dictionary whose values are integers or reals.
Returns:
The mean of values in mydict. float
mean_value() calculates the mean from all values in a
dictionary.

Definition at line 494 of file pyp_network.py.

def PyPedal::pyp_network::most_influential_offspring (   pedgraph,
  anid,
  resolve = 'all' 
)

most_influential_offspring() returns the most influential offspring of an animal as measured by their number of offspring.

Parameters:
pedgraph An instance of a networkx DiGraph.
anid The animal for whom the most influential offspring is to be found.
resolve Indicates how ties should be handled ('first'|'last'|'all').
Returns:
The most influential offspring of anid. dictionary
most_influential_offspring() returns the most influential offspring of an animal as
measured by their number of offspring.

Definition at line 219 of file pyp_network.py.

def PyPedal::pyp_network::offspring_influence (   pedgraph,
  anid 
)

offspring_influence() returns the number of grand-children by each child of a given animal.

Parameters:
pedgraph An instance of a networkx DiGraph.
anid The animal for whom grand-progeny are to be counted.
Returns:
A dictionary of counts of progeny per child. dictionary
offspring_influence() returns the number of grand-children by each child of a given
animal.

Definition at line 197 of file pyp_network.py.

def PyPedal::pyp_network::ped_to_graph (   pedobj,
  oid = 0 
)

ped_to_graph() Takes a PyPedal pedigree object and returns a networkx XDiGraph object.

Parameters:
pedobj A PyPedal pedigree object.
oid Flag indicating if original (1) or renumbered (0) IDs should be used.
Returns:
DiGraph object graph
ped_to_graph() Takes a PyPedal pedigree object and returns a networkx XDiGraph
object.

Definition at line 57 of file pyp_network.py.


Generated on Fri Mar 28 14:34:59 2008 for PyPedal by  doxygen 1.5.3