Description Usage Arguments Details Value Author(s) References See Also Examples

Reads the geographical information provided in a file in graph format and stores it in a map object.

1 |

`file` |
the file path of the graph file to be read. |

`sorted` |
logical. Should the regions be ordered by the numbers specifying the region names
( |

`sep` |
the field separator character. Values on each line of the file are separated by this character. |

A graph file stores the nodes and the edges of a graph and is a convenient way to represent the neighborhood structure of a geographical map. The structure of a graph file is given by:

The first line of the graph file specifies the total number of nodes.

The subsequent three lines correspond to the node with the name given in line 2, the number of neighbors in line 3 and the neighboring node identity numbers in line 4.

Note that the note identity numbering starts with `0`

. Example taken from the package
example file `Germany.gra`

:

309 |

1001 |

1 |

1 |

1059 |

3 |

0 3 4 |

1002 |

2 |

5 4 |

1051 |

3 |

4 1 9 |

1058 |

7 |

2 6 3 5 1 10 9 |

... |

Hence, this graph file contains of 309 regions. The first region with name 1001 has 1 neighbor with neighboring node identity number 1. The last region in this example, region 1058, has 7 neighbors with neighboring node identity numbers 2 6 3 5 1 10 9.

In addition, graph files using the following format may be imported:

The first line of the graph file specifies the total number of nodes.

The subsequent lines start with the node name followed by the number of neighbors and the neighboring node identity numbers.

Example:

309 |

1001 1 2 |

1059 3 1 4 5 |

1002 2 6 5 |

1051 3 5 2 10 |

1058 7 3 7 4 6 2 11 10 |

... |

Returns an adjacency matrix that represents the neighborhood structure defined in the graph file.
The diagonal elements of this matrix are the number of neighbors of each region. The off-diagonal
elements are either `-1`

if regions are neighbors else `0`

.

Thomas Kneib, Felix Heinzl, rewritten by Nikolaus Umlauf.

BayesX Reference Manual, Chapter 5. Available at http://www.BayesX.org.

`write.gra`

, `read.bnd`

, `write.bnd`

,
`get.neighbor`

, `add.neighbor`

, `delete.neighbor`

.

1 2 | ```
file <- file.path(find.package("R2BayesX"), "examples", "Germany.gra")
germany <- read.gra(file)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.