Description Usage Arguments Value Author(s) Examples
The resulting graph is directed. Depending to parameters its vertices might be attributed.
1 2 |
pop |
the population to convert |
with.attributes |
if TRUE, the attributes of entities are copied as vertex attributes |
... |
ignored |
an igraph graph
Samuel Thiriot <samuel.thiriot@res-ear.ch>
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 | library(igraph)
# generate a population based on sample case 1
data(dwellings_households)
prepared <- matching.prepare(
dwellings_households$sample.A, dwellings_households$sample.B,
dwellings_households$pdi, dwellings_households$pdj,
dwellings_households$pij)
solved <- matching.solve(prepared,
nA=500,nB=400,
nu.A=0, phi.A=0, delta.A=1,
gamma=1,
delta.B=0, phi.B=0, nu.B=0)
sampled <- matching.generate(solved, dwellings_households$sample.A, dwellings_households$sample.B)
# convert the population as a population
g <- as.igraph(sampled$pop, with.attributes=TRUE)
# can export the graph using one of the igraph formats
write.graph(g,file="mygraph.graphml", format="graphml")
# can visualize the population as a graph
#lay <- layout_nicely(g)
#tkplot(g,layout=lay)
# test structural properties
is.connected(g)
average.path.length(g)
# check attributes
# ... list all the attributes defined for verticies
vertex_attr_names(g)
# ... view all attributes
vertex_attr(g)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.