orca {orca} | R Documentation |
Orbit counting
Description
Count the node or edge orbits in 4- or 5- node graphlets for all nodes (edges) in the given graph.
Usage
count4(graph)
count5(graph)
ecount4(graph)
ecount5(graph)
Arguments
graph |
A graph given as a nx2 edge matrix, a data frame with edges or a graph object from the package 'graph'. The nodes in the matrix or data frame are given by integer indices that start with 1. |
Value
A numeric matrix or orbit counts. Rows correspond to graph nodes or edges in the same order as on the input, and the columns corresponding to orbits.
Author(s)
Tomaz Hocevar and Janez Demsar
References
Tomaz Hocevar, Janez Demsar (2016): Computation of Graphlet Orbits for Nodes and Edges in Sparse Graphs. Journal of Statistical Software, 71(10), pp. 1-24.
Examples
library(orca)
# Load and show the orbit counts for the Karate graph
data("karate")
count4(karate)
## Not run:
# Simple analysis of School Wikipedia network: find the most similar
# nodes with respect to the local network topology
# Requires data from http://www.biolab.si/supp/Rorca/_downloads/schools-wiki.zip
library("FNN")
nodes <- scan("schools-wiki-nodes.txt", what="", sep="\n")
edges <- read.table("schools-wiki-edges.txt")
orbits <- count4(edges)
nn <- get.knn(orbits, k=10)
neighbours <- nn$nn.index
distances <- nn$nn.dist
check <- c("Canada", "Germany", "Isaac Newton", "Albert Einstein",
"Mahatma Gandhi", "Mahabharata")
node_indices <- match(check, nodes)
for (i in 1:length(check)) {
cat("\n\n", check[i], ": ", sep="")
cat(nodes[neighbours[node_indices[i], ]], sep=", ")
cat("\n")
cat(round(distances[node_indices[i], ]), sep=", ")
}
## End(Not run)
[Package orca version 1.1-2 Index]