An adjacency list representation of a graph G is simply an array of size Nv, ordered with respect to the ordering of the vertices in V, each element of which is a list, where the ith list contains the set of all vertices j for which there is an edge from i to j. This is the representation usually used by igraph, evident in printing the output from the structure function str.
The function get.edgelist returns an edge list as a two-column R matrix.
Finally, graphs can also be stored in matrix form. The Nv × Nv adjacency matrix for a graph G = (V,E), say A, is defined so that A_{ij} = 1, if i, j} ∈ E, or A_{ij} = 0, otherwise.
get.adjacency(g)
In igraph, network data already loaded into R in these specific formats can be used to generate graphs using the functions graph.adjlist, graph.edgelist, and graph.adjacency, respectively.
For data stored in a file, the function read.graph can be used. In fact, this latter function not only supports the three formats discussed above, but also a number of other formats (e.g., such as GraphML, Pajek, etc.). Conversely, the function write.graph can be used to save graphs in various formats.
No comments:
Post a Comment