Multi-Dendrix Logo

This Page

multi_dendrix.permute.mutation_data.bipartite_double_edge_swap

multi_dendrix.permute.mutation_data.bipartite_double_edge_swap(G, genes, patients, nswap=1, max_tries=9.9999999999999993e+74)[source]

A modified version of the double_edge_swap function in NetworkX to preserve the bipartite structure of the graph.

For more details on this function, please see the original NetworkX function that I shamelessly used to make this one. The only major change here is that I ensure that u,v and x,y are of the same type (i.e. genes or patients).

Parameters:
  • G (NetworkX Graph) – Bipartite graph G(V, E) representation of mutation data. Vertices are genes and patients, and edges connect genes mutated in particular patients.
  • genes (list) – genes in the mutation data.
  • patients (list) – patients in the mutation data.
  • nswap (int) – number of edge swaps to perform (default: 1).
  • max_tries (int) – maximum number of attempted edge swaps to perform (default: 1e75).
Returns:

Bipartite graph G (modified in place).

See also: permute_mutation_data().