Skip to content

undirected graph from adjacency matrix without symmetric matrix #182

@adfi

Description

@adfi

The docs say the following when mode is "undirected" (and weighted =TRUE):

First we check that the matrix is symmetric. It is an error if not. Then only the upper triangle is used to create a weighted undirected graph.

But the following code (adapted from the example) runs just fine:
adjm <- matrix(runif(100), 10)
adjm[ adjm<0.5 ] <- 0
graph_from_adjacency_matrix(adjm, weighted=TRUE, mode="undirected")

The example does force a symmetric matrix through (adjm + t(adjm))/2. When looking at the documentation the function graph.adjacency.sparse has a check for symmetry but the function graph.adjacency.dense does not.

Obviously nothing is lost as in with or without a symmetric matrix the result is the same. The question is whether this is intentional and if the docs need to be updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions