read_network: Read a third-party graph file with igraph

View source: R/data-access-io-prepare.R

read_networkR Documentation

Read a third-party graph file with igraph

Description

Read a third-party graph file with igraph

Usage

read_network(
  path,
  format = c("graphml", "gml", "ncol", "lgl", "pajek", "edgelist"),
  output_network_format = c("igraph", "sparse", "legacy"),
  case_sensitive = FALSE,
  ...,
  network_format = NULL,
  species,
  input_id_format = master_id_format(species),
  id_mappings = NULL,
  ambiguous = c("error", "drop", "first", "expand"),
  unmapped = c("keep", "drop", "error")
)

Arguments

path

Input graph file.

format

An igraph reader format.

output_network_format

Return an igraph, sparse, or legacy NEArender network.

case_sensitive

Preserve identifier case.

...

Additional arguments passed to igraph::read_graph().

network_format

Deprecated alias for output_network_format.

species

Required species identifier accepted by available_id_formats(). Use explicit NULL for unsupported species or non-biological data.

input_id_format

Submitted identifier format. Defaults to master_id_format() for species; required when species = NULL.

id_mappings

Optional object from load_id_mappings(). When supplied, both endpoints are converted to its species master format.

ambiguous, unmapped

Mapping policies passed to map_identifiers().

Value

A normalized igraph, sparse, or legacy NEArender network.

See Also

import_network(), export_network(), convert_network()

Examples

graph <- import_network(data.frame(from = "A", to = "B", score = 2),
  score_column = "score", species = NULL, input_id_format = "custom",
  verbose = FALSE)
path <- tempfile(fileext = ".graphml")
export_network(graph, path)
restored <- read_network(path, species = NULL, input_id_format = "custom")
unlink(path)
igraph::edge_attr(restored, "weight")

NEArender documentation built on Nov. 28, 2026, 5:10 p.m.