as.edgedataframe {ORION} | R Documentation |
Coerce to an Edge List
Description
Converts from a Subcascades object to a weighted edge list.
Usage
as.edgedataframe(subcascades)
Arguments
subcascades |
A Subcascades object as it is returned by |
Details
Converts a Subcascades object to a data.frame that can be used to generate a graph.
Value
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.
See Also
Examples
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)))