Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

[BUG] random_regular_digraph #1558

@ppunosevac

Description

@ppunosevac

Description of bug
adjacency_matrix(random_regular_digraph(10, 4)) doesn't produce a regular digraph. in-degrees are messed up.

How to reproduce
using LightGraphs
adjacency_matrix(random_regular_digraph(10, 4))

Expected behavior
I expect row sums and column sums to be the constant equal to four.

Actual behavior

10×10 SparseArrays.SparseMatrixCSC{Int64, Int64} with 40 stored entries:
⋅ 1 1 ⋅ 1 ⋅ ⋅ 1 ⋅ ⋅
⋅ ⋅ ⋅ ⋅ ⋅ 1 ⋅ 1 1 1
⋅ ⋅ ⋅ 1 ⋅ 1 ⋅ 1 ⋅ 1
⋅ ⋅ ⋅ ⋅ ⋅ 1 1 1 1 ⋅
⋅ 1 1 ⋅ ⋅ 1 ⋅ 1 ⋅ ⋅
⋅ ⋅ ⋅ 1 ⋅ ⋅ 1 1 ⋅ 1
⋅ ⋅ 1 1 ⋅ ⋅ ⋅ 1 1 ⋅
⋅ 1 ⋅ ⋅ 1 1 ⋅ ⋅ 1 ⋅
⋅ ⋅ ⋅ 1 ⋅ 1 1 1 ⋅ ⋅
⋅ ⋅ 1 1 ⋅ ⋅ ⋅ 1 1 ⋅

Code demonstrating bug

using LightGraphs
adjacency_matrix(random_regular_digraph(10, 4))

julia> versioninfo() Julia Version 1.6.0 Commit f9720dc2eb (2021-03-24 12:55 UTC) Platform Info: OS: Linux (x86_64-pc-linux-gnu) CPU: Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-11.0.1 (ORCJIT, broadwell)

(@v1.6) pkg> status LightGraphs Status ~/.julia/environments/v1.6/Project.toml [093fc24a] LightGraphs v1.3.5

I hope I am wrong. If this turns out to be a real bug I would love to help implement the state of the art

https://arxiv.org/abs/1511.01175

Metadata

Metadata

Assignees

No one assigned

    Labels

    not a bugrepresents intended behavior

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions