Description Usage Arguments Details Value See Also Examples
View source: R/as.edgedataframe.R
Converts from a Subcascades object to a weighted edge list.
1 |
subcascades |
A Subcascades object as it is returned by |
Converts a Subcascades object to a data.frame that can be used to generate a graph.
A data.frame that can be used to generate a graph. The first and second column correspond to all pairwise relations (from - to) of the cascades within the Subcascades object. The 'CASC_ID' column contains the same ID for all edges belonging to the same cascade. The 'SIZE' column gives the size of the cascade to which the repective column bleongs. The method returns NULL if the object subcascades is empty.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | library(TunePareto)
library(igraph)
data(esl)
data = esl$data
labels = esl$labels
predMap = predictionMap(data, labels,
classifier = tunePareto.svm(), kernel='linear')
# generate a dataframe
subcascades = subcascades(predMap,thresh=0.65,size=4)
edges = as.edgedataframe(subcascades)
g = graph_from_data_frame(edges[,c(1,2)], directed = TRUE)
E(g)$weight = edges[,3]
plot(g,edge.color=edges[,3],edge.arrow.size=0.5,
edge.curved =seq(-0.5, 1, length = ecount(g)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.