View source: R/measures_net_dis.R
netdis_one_to_one | R Documentation |
Calculates the different variants of the network dissimilarity statistic Netdis between two graphs. The variants currently supported are Netdis using a gold-standard network, Netdis using no expecations (ref_graph = 0
), and Netdis using a Geometric Poisson approximation for the expectation (ref_graph = NULL
).
netdis_one_to_one( graph_1 = NULL, graph_2 = NULL, ref_graph = 0, max_graphlet_size = 4, neighbourhood_size = 2, min_ego_nodes = 3, min_ego_edges = 1, binning_fn = NULL, bin_counts_fn = NULL, exp_counts_fn = NULL, graphlet_counts_1 = NULL, graphlet_counts_2 = NULL, graphlet_counts_ref = NULL )
graph_1 |
A simple graph object from the |
graph_2 |
A simple graph object from the |
ref_graph |
Controls how expected counts are calculated. Either:
1) A numeric value - used as a constant expected counts value for all query
graphs .
2) A simplified |
max_graphlet_size |
Generate graphlets up to this size. Currently only 4 (default) and 5 are supported. |
neighbourhood_size |
Ego network neighborhood size (default: 2). |
min_ego_nodes |
Filter ego networks which have fewer than min_ego_nodes nodes (default: 3). |
min_ego_edges |
Filter ego networks which have fewer than min_ego_edges edges (default: 1). |
binning_fn |
Function used to bin ego network densities. Takes edge |
bin_counts_fn |
Function used to calculate expected graphlet counts in
each density bin. Takes |
exp_counts_fn |
Function used to map from binned reference counts to
expected counts for each graphlet in each ego network of the query graphs.
Takes |
graphlet_counts_1 |
Pre-generated graphlet counts for the first query
graph. Matrix containing counts of each graphlet (columns) for
each ego-network (rows) in the input graph. Columns are labelled with
graphlet IDs and rows are labelled with the ID of the central node in each
ego-network. As well as graphlet counts, each matrix must contain an
additional column labelled "N" including the node count for
each ego network. (default: NULL).
If the |
graphlet_counts_2 |
Pre-generated graphlet counts for the second query
graph. Matrix containing counts of each graphlet (columns) for
each ego-network (rows) in the input graph. Columns are labelled with
graphlet IDs and rows are labelled with the ID of the central node in each
ego-network. As well as graphlet counts, each matrix must contain an
additional column labelled "N" including the node count for
each ego network. (default: NULL).
If the |
graphlet_counts_ref |
Pre-generated reference graphlet counts.
Matrix containing counts of each graphlet (columns) for
each ego-network (rows) in the reference graph. Columns are labelled with
graphlet IDs and rows are labelled with the ID of the central node in each
ego-network. As well as graphlet counts, each matrix must contain an
additional column labelled "N" including the node count for
each ego network. (default: NULL).
If the |
Netdis statistics between graph_1 and graph_2 for graphlet sizes up to and including max_graphlet_size.
require(netdist) require(igraph) #Set source directory for Virus PPI graph edge files stored in the netdist package. source_dir <- system.file(file.path("extdata", "VRPINS"), package = "netdist") # Load query graphs as igraph objects graph_1 <- read_simple_graph(file.path(source_dir, "EBV.txt"),format = "ncol") graph_2 <- read_simple_graph(file.path(source_dir, "ECL.txt"),format = "ncol") #Netdis variant using the Geometric Poisson approximation to remove the background expectation of each network. netdis_one_to_one(graph_1= graph_1, graph_2= graph_2, ref_graph = NULL) #This option will focus on detecting more general and global discrepancies between the ego-network structures. #Comparing the networks via their observed ego counts without centering them (equivalent to using expectation equal to zero). This option, will focus on detecting small discrepancies. netdis_one_to_one(graph_1= graph_1, graph_2= graph_2, ref_graph = 0) # Example of the use of netdis with a reference graph.This option will focus on detecting discrepancies between the networks relative to the ego-network structure of the reference network / gold-standard. # Two lattice networks of different sizes are used for this example. goldstd_1 <- graph.lattice(c(8,8)) #A reference net goldstd_2 <- graph.lattice(c(44,44)) #A reference net netdis_one_to_one(graph_1= graph_1, graph_2= graph_2, ref_graph = goldstd_1) netdis_one_to_one(graph_1= graph_1, graph_2= graph_2, ref_graph = goldstd_2) #Providing pre-calculated subgraph counts. props_1 <- count_graphlets_ego(graph = graph_1) props_2 <- count_graphlets_ego(graph = graph_2) props_goldstd_1 <- count_graphlets_ego(graph = goldstd_1) props_goldstd_2 <- count_graphlets_ego(graph = goldstd_2) #Netdis Geometric-Poisson. netdis_one_to_one(graphlet_counts_1= props_1,graphlet_counts_2= props_2, ref_graph = NULL) #Netdis Zero Expectation. netdis_one_to_one(graphlet_counts_1= props_1,graphlet_counts_2= props_2, ref_graph = 0) #Netdis using gold-standard network netdis_one_to_one(graphlet_counts_1= props_1,graphlet_counts_2= props_2, graphlet_counts_ref = props_goldstd_1) netdis_one_to_one(graphlet_counts_1= props_1,graphlet_counts_2= props_2, graphlet_counts_ref = props_goldstd_2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.