Description Usage Arguments Examples
View source: R/validateGraph.R
Aster uses the following pair of tables to store graph data:
- vertices table with unique key and optional attributes
- Edges table with source, target and optional attributes
Also see toaGraph
Graph validation checks for the following:
Both tables exist (error returned).
Edge sources exist in the vertices table.
Edge targets exist in the vertices table.
No duplicate vertices defined.
No duplicate edges defined.
No loops (self-directed edges) defined.
1 2 3 | validateGraph(channel, graph, weight = NULL,
vertexWhere = graph$vertexWhere, edgeWhere = graph$edgeWhere,
allTables = NULL, test = FALSE)
|
channel |
connection object as returned by |
graph |
an object of class |
weight |
logical or character: if logical then |
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 | if(interactive()) {
# 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>")
# undirected graph
policeGraphUn = toaGraph(vertices="dallaspolice_officer_vertices",
edges="dallaspolice_officer_edges_un",
directed=FALSE, key="officer",
source="officer1", target="officer2",
vertexAttrnames = c("offense_count"),
edgeAttrnames = c("weight"))
validateGraph(conn, policeGraphUn)
# directed graph
policeGraphDi = toaGraph(edges="dallaspolice_officer_vertices",
vertices="dallaspolice_officer_edges_di",
directed=TRUE, key="officer",
source="officer1", target="officer2",
vertexAttrnames = c("offense_count"),
edgeAttrnames = c("weight"))
validateGraph(conn, policeGraphDi, weight=TRUE)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.