【发布时间】:2018-09-19 07:44:26
【问题描述】:
我想从 Julia (v0.7) 中的邻接矩阵生成加权和有向网络。
到目前为止我已经尝试过:
using LightGraphs
using SimpleWeightedGraphs
A = rand(100, 100)
G = Graph(A)
但我得到错误:
ERROR: ArgumentError: Adjacency / distance matrices must be symmetric
Stacktrace:
[1] SimpleGraph{Int64}(::Array{Float64,2}) at /home/user/.julia/packages/LightGraphs/PPsyP/src/SimpleGraphs/simplegraph.jl:78
[2] SimpleGraph(::Array{Float64,2}) at /home/user/.julia/packages/LightGraphs/PPsyP/src/SimpleGraphs/simplegraph.jl:72
[3] top-level scope at none:0
到目前为止,我只看到了 github (https://github.com/JuliaGraphs/SimpleWeightedGraphs.jl) 页面上的示例,该示例从边缘列表生成加权图。但是,如果我可以直接从邻接矩阵生成图形,我会更喜欢。
【问题讨论】:
标签: julia lightgraphs