to_graphml: Export to GraphML

View source: R/converters.R

to_graphmlR Documentation

Export to GraphML

Description

Writes a bibnets edge list (and optional node attributes) to a GraphML file using pure base R — no XML package required.

Usage

to_graphml(edges, nodes = NULL, file = NULL, directed = FALSE)

Arguments

edges

A data frame with at least from, to, weight columns.

nodes

Optional data frame of node attributes with an id column.

file

File path to write. If NULL (default), returns the GraphML as a character string.

directed

Logical. Default FALSE.

Value

If file = NULL: GraphML as a character string. Otherwise writes the file and returns the path invisibly.

Examples

data(biblio_data)
edges <- keyword_network(biblio_data)
xml <- to_graphml(edges)
cat(substr(xml, 1, 300))

bibnets documentation built on June 19, 2026, 1:06 a.m.