# NOT RUN {
# create an edgelist
un_graphe <- rbind(
c("fromage", "pain"),
c("pain", "vin"),
c("vin", "biere"),
c("cidre", "biere"),
c("foie", "fromage"),
c("pain", "foie"))
# deafult arcplot
arcplot(un_graphe)
# vertical display
arcplot(un_graphe, horizontal=FALSE)
# arcplot with arcs above and below axis
arcplot(un_graphe, above = c(1, 3, 5))
# nodes sorted alphabetically (increasing)
arcplot(un_graphe, sorted=TRUE)
# nodes sorted alphabetically (decreasing)
arcplot(un_graphe, sorted=TRUE, decreasing = TRUE)
# provided order for nodes
new_order = c("vin", "biere", "cidre", "fromage", "foie", "pain")
arcplot(un_graphe, ordering = new_order)
# generate graphs
ring_graph = graph.ring(10)
star_graph = graph.star(10, mode="out")
tree_graph = graph.tree(10, 2)
# add names to nodes
V(ring_graph)$name = letters[1:vcount(ring_graph)]
V(star_graph)$name = paste("Node", 1:vcount(star_graph))
V(tree_graph)$name = paste("V", 1:vcount(tree_graph), sep='')
# extract edgelist
ring_edges = get.edgelist(ring_graph)
star_edges = get.edgelist(star_graph)
tree_edges = get.edgelist(tree_graph)
# arc diagram
arcplot(ring_edges, labels=V(ring_graph)$name, las=1)
arcplot(star_edges, labels=V(star_graph)$name, las=2)
arcplot(tree_edges, labels=V(tree_graph)$name, las=2)
# compare to plot.igraph
plot(ring_graph, vertex.label=V(ring_graph)$name)
plot(star_graph, vertex.label=V(star_graph)$name)
plot(tree_graph, vertex.label=V(tree_graph)$name)
# }
Run the code above in your browser using DataLab