Description Usage Arguments Details Value Examples
Results in network object representation of the graph
stored in Aster tables. Usually in Aster database a graph is represented
using a pair of vertice and edge tables (see toaGraph).
1 2 | computeGraph(channel, graph, v = NULL, vertexWhere = graph$vertexWhere,
edgeWhere = graph$edgeWhere, allTables = NULL, test = FALSE)
|
channel |
connection object as returned by |
graph |
an object of class |
v |
a SQL |
vertexWhere |
optionally, a |
edgeWhere |
optionally, a |
allTables |
pre-built information about existing tables. |
test |
logical: if TRUE show what would be done, only (similar to parameter |
Use caution when computing network objects stored in Aster with this function as data may include considerable amount of vertices and edges which are too large to load into a memory.
copmuteGraph will use graph defined by graph if neither of the arguments
vertexWhere, or edgeWhere provided. When one or more of them
defined then they override corresponding attributes in the graph. On top of it,
argument v specifies concrete vertices to include in the resulting graph.
In case when only edges table specified argument vertexWhere will trigger error
while argument v is still valid.
network class object materializing an Aster graph represented by toaGraph.
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 | if(interactive()) {
library(GGally)
policeGraphUn = toaGraph("dallaspolice_officer_vertices", "dallaspolice_officer_edges_un",
directed = FALSE, 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>")
# create network object and visualize with ggplot2
net1 = computeGraph(conn, policeGraphUn)
ggnet2(net1, node.label="vertex.names", node.size="offense_count",
legend.position="none")
# network object with filters and color attribute
net2 = computeGraph(conn, policeGraphUn, vertexWhere = "officer ~ '[A-Z].*'",
edgeWhere = "weight > 0.36")
net2 %v% "color" = substr(get.vertex.attribute(net2, "vertex.names"), 1, 1)
ggnet2(net2, node.label="vertex.names", node.size="offense_count",
size.cut=TRUE, node.color="color", legend.position="none",
palette = "Set2")
# networ object for subgraph of top degree vertices
topDegree = computeGraphMetric(conn, policeGraphUn, type="degree", top=50)
net3 = computeGraph(conn, policeGraphUn, v=as.list(as.character(topDegree$key)))
net3 %v% "degree" = topDegree[match(get.vertex.attribute(net3, "vertex.names"),
topDegree$key), "degree"]
ggnet2(net3, node.label="vertex.names", node.size="degree",
legend.position="none")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.