Title: | Graph Prediction from a Graph Time Series |
---|---|
Description: | Predicting the structure of a graph including new nodes and edges using a time series of graphs. Flux balance analysis, a linear and integer programming technique used in biochemistry is used with time series prediction methods to predict the graph structure at a future time point Kandanaarachchi (2024) <doi:10.48550/arXiv.2401.04280>. |
Authors: | Sevvandi Kandanaarachchi [aut, cre] |
Maintainer: | Sevvandi Kandanaarachchi <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.1.1 |
Built: | 2024-11-12 06:46:31 UTC |
Source: | https://github.com/sevvandi/netseer |
Generates a bigger graph using parameters for node and edge growth. If a sequence of graphs are created, the number of nodes in this sequence would exponentially increase.
generate_graph_exp( gr = NULL, del_edge = 0.1, new_nodes = 0.1, edge_increase = 0.1 )
generate_graph_exp( gr = NULL, del_edge = 0.1, new_nodes = 0.1, edge_increase = 0.1 )
gr |
The input graph to generate the next graph. If set to |
del_edge |
The proportion of edges deleted from the input graph. Default
set to |
new_nodes |
The proportion of nodes added to the input graph. Default
set to |
edge_increase |
The proportion of edges added to the input graph. Default
set to |
A graph.
set.seed(1) gr <- generate_graph_exp() gr
set.seed(1) gr <- generate_graph_exp() gr
Generates a bigger graph using parameters for node and edge growth. If a sequence of graphs are created, the number of nodes would linearly increase.
generate_graph_linear( gr = NULL, del_edge = 1, new_nodes = 1, edge_increase = 1, edges_per_new_node = 3 )
generate_graph_linear( gr = NULL, del_edge = 1, new_nodes = 1, edge_increase = 1, edges_per_new_node = 3 )
gr |
The input graph to generate the next graph. If set to |
del_edge |
The number of edges deleted from the input graph. Default
set to |
new_nodes |
The number of nodes added to the input graph. Default
set to |
edge_increase |
The number of edges added to the input graph. Default
set to |
edges_per_new_node |
The number of edges added to the new nodes. Default
set to |
A graph.
set.seed(1) gr <- generate_graph_linear() gr
set.seed(1) gr <- generate_graph_linear() gr
This function predicts the graph at a future time step using a time series of graphs.
predict_graph( graphlist, formulation = 2, conf_level1 = NULL, conf_level2 = 90, dense_opt = 2, weights_opt = 6, weights_param = 0.001, h = 1 )
predict_graph( graphlist, formulation = 2, conf_level1 = NULL, conf_level2 = 90, dense_opt = 2, weights_opt = 6, weights_param = 0.001, h = 1 )
graphlist |
A list of graphs in igraph format. |
formulation |
Formulation 2 includes an additional condition constraining total
edges by the predicted value. Formulation 1 does not have that constraint. Formulation 2
gives more realistic graphs due to that constraint. Default is set to |
conf_level1 |
A value between 50 and 100 denoting the confidence interval
for the number of predicted nodes in the graph. If set to |
conf_level2 |
The upper confidence bound for the degree distribution. Default
set to |
dense_opt |
If set to |
weights_opt |
Weights option ranging from 1 to 6 used for different edge weight
schemes. Weights option 1 uses uniform weights for all edges. Option 2 uses binary
weights. If the edge existed in a past graph, then weight is set to 1. Else set to
0. All possible new edges are assigned weight 1. Option 3 is a more selective
version. Option 4 uses proportional weights according to the history. Option 5 uses
proportional weights, but as the network is more in the past, it gives less weight.
Option 5 uses linearly decaying proportional weights. Option 6 uses harmonically decaying
weights. That is the network at |
weights_param |
The weight given for possible edges from new vertices. Default
set to |
h |
The prediction time step. Default is |
A list of predicted graphs. If conf_level1
is not NULL
, then
3 graphs are returned one with the mean number of predicted nodes and the other 2
with the number of nodes equal to the lower and upper bound values of prediction.
If If conf_level1
is NULL
, only the mean predicted graph is returned.
set.seed(2024) edge_increase_val <- new_nodes_val <- del_edge_val <- 0.1 graphlist <- list() graphlist[[1]] <- gr <- igraph::sample_pa(5, directed = FALSE) for(i in 2:15){ gr <- generate_graph_exp(gr, del_edge = del_edge_val, new_nodes = new_nodes_val, edge_increase = edge_increase_val ) graphlist[[i]] <- gr } grpred <- predict_graph(graphlist[1:15], conf_level2 = 90, weights_opt = 6) grpred
set.seed(2024) edge_increase_val <- new_nodes_val <- del_edge_val <- 0.1 graphlist <- list() graphlist[[1]] <- gr <- igraph::sample_pa(5, directed = FALSE) for(i in 2:15){ gr <- generate_graph_exp(gr, del_edge = del_edge_val, new_nodes = new_nodes_val, edge_increase = edge_increase_val ) graphlist[[i]] <- gr } grpred <- predict_graph(graphlist[1:15], conf_level2 = 90, weights_opt = 6) grpred