Skip to content

Commit

Permalink
add edges in row-first order not col-first
Browse files Browse the repository at this point in the history
  • Loading branch information
schochastics committed Jan 9, 2025
1 parent 97a791f commit 2831321
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions R/incidence.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ graph.incidence.dense <- function(incidence, directed, mode, multiple,
# create an edgelist from the nonzero entries of the
# incidence matrix
idx <- which(incidence != 0, arr.ind = TRUE)
# convert to row-first order
idx <- idx[order(idx[, 1], idx[, 2]), ]
# add the value of the matrix. So a row is [s,t,incidence[s,t]]
el <- cbind(idx, incidence[idx])

Expand Down

0 comments on commit 2831321

Please sign in to comment.