Package biana :: Package GraphUtilities :: Module GraphUtilities
[hide private]
[frames] | no frames]

Module GraphUtilities

source code

BIANA: Biologic Interactions and Network Analysis Copyright (C) 2009 Javier Garcia-Garcia, Emre Guney, Baldo Oliva

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Functions [hide private]
 
create_graph_with_same_type(G) source code
 
create_graph()
Creates & returns a graph
source code
 
get_number_of_distinct_edges(G) source code
 
get_shortest_path_between(G, source_id, target_id) source code
 
get_all_paths_from(G, source_id)
get all paths from source node to all possible nodes in a dictionary
source code
 
get_path_network(G, listNodes, path_length_cutoff=10000)
Returns a subgraph containing only nodes in listNodes
source code
 
get_connected_components(G, return_as_graph_list=True)
Finds (strongly in the case of directed network) connected components of graph returnAsGraphList: returns list of graph objects corresponding to connected components (from larger to smaller) otherwise returns list of node list corresponding nodes in connected components
source code
 
randomize_graph(graph, randomization_type)
Creates a random network from given network as a networkx graph randomization_type:
source code
Variables [hide private]
  MAX_NUMBER_OF_TRIAL = 6
Function Details [hide private]

get_path_network(G, listNodes, path_length_cutoff=10000)

source code 

Returns a subgraph containing only nodes in listNodes

Nodes are connected if exist a path between them, and weight of the edge consists in the length of shortest path

If the shortest between two nodes includes another node in the list, this edge is not added

randomize_graph(graph, randomization_type)

source code 

Creates a random network from given network as a networkx graph randomization_type:

  • "random": add same number of edges randomly between nodes of original graph
  • "preserve_topology": keep edges, shuffle nodes of original graph
  • "preserve_topology_and_node_degree": keep edges, shuffle nodes of original graph with the nodes of same degree
  • "preserve_degree_distribution": remove an edge between two random nodes with degrees k, l then add to two nodes with degrees k-1 & l-1, then shuffle nodes
  • "preserve_degree_distribution_and_node_degree": remove 2 random edges between a-b and c-d where degree(a)=degree(c) and degree(b)=degree(d) then add 2 edges between a-d and b-c, then shuffle nodes with the same degree