Learn R Programming

RBGL (version 1.48.1)

removeSelfLoops: remove self loops in a graph

Description

remove self loops in a graph

Usage

removeSelfLoops(g)

Arguments

g
one instance of the graph class

Value

A new graph without self loops.

Details

If a given graph contains self-loop(s), removeSelfLoops removes them. This is for those functions that cannot handle graphs with self-loops.

Examples

Run this code
con <- file(system.file("XML/dijkex.gxl",package="RBGL"))
g1 <- fromGXL(con)
close(con)

g2 <- ugraph(g1)
removeSelfLoops(g2)

Run the code above in your browser using DataLab