Description Usage Arguments Examples
Find the vertices not farther than a given limit from another fixed vertex, and create egographs (subgraphs) with the given order parameter.
1 2 3 4 |
channel |
connection object as returned by |
graph |
an object of class |
ego |
list of vertices for which the calculation of corresponding ego graphs is performed. |
order |
integer giving the order of the ego graph neighborhood. |
mode |
character constant, it specifies how to use the direction of the edges if a directed graph is analyzed.
For |
createDistanceAttr |
logical: indicates if vertices should receive attribute with the distance to ego graph centeral vertex. |
distanceAttrname |
name of the vertex distance attribute. |
vertexWhere |
SQL WHERE clause limiting data from the vertex table. This value when not null
overrides corresponding value |
edgeWhere |
SQL WHERE clause limiting data from the edge table. This value when not null
overrides corresponding value |
allTables |
pre-built information about existing tables. |
test |
logical: if TRUE show what would be done, only (similar to parameter |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | if(interactive()) {
library(GGally)
policeGraphDi = toaGraph(vertices = "dallaspolice_officer_vertices",
edges = "dallaspolice_officer_edges_di",
directed = TRUE,
key = "officer", source = "officer1", target = "officer2",
vertexAttrnames = c("offense_count"),
edgeAttrnames = c("weight"))
# initialize connection to Lahman baseball database in Aster
conn = odbcDriverConnect(connection="driver={Aster ODBC Driver};
server=<dbhost>;port=2406;database=<dbname>;uid=<user>;pwd=<pw>")
setVertexColor <- function(graph, vertex, color="red", default="grey") {
graph %v% "color" =
ifelse(get.vertex.attribute(graph, "vertex.names") == as.character(vertex),
color, default)
return(graph)
}
topPagerankPolice = computeGraphMetric(conn, policeGraphDi, type='pagerank', top=3)
egoCenters = as.list(as.character(topPagerankPolice$key))
egoGraphsTopPagerank = computeEgoGraph(conn, policeGraphDi, order = 1, ego = egoCenters)
egoGraph = setVertexColor(egoGraphsTopPagerank[[1]], egoCenters[[1]])
ggnet2(egoGraph, node.label="vertex.names", node.size="offense_count",
legend.position="none", color="color")
egoGraph = setVertexColor(egoGraphsTopPagerank[[2]], egoCenters[[2]])
ggnet2(egoGraph, node.label="vertex.names", node.size="offense_count",
legend.position="none", color="color")
egoGraph = setVertexColor(egoGraphsTopPagerank[[3]], egoCenters[[3]])
ggnet2(egoGraph, node.label="vertex.names", node.size="offense_count",
legend.position="none", color="color")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.